This plugin enables support for building jmod
artifacts in Gradle JVM projects. Java module artifacts can be used
at compile time, similar to JARs, but support a lot more artifact ephemera: header files, man files, native linkage, and
native command binaries, to name a few.
Binary Java module artifacts can also be used with jlink
to produce an optimized stand-alone binary for a modular
Java application. Using the JLink Plugin, such outputs can be built with jmod
artifacts as dependencies,
even when classpath
use is involved.
build.gradle.kts
:
plugins {
id("dev.elide.jmod") version "..."
}
libs.versions.toml
:
[versions]
elide-infra = "..."
[plugins]
jmod = { id = "dev.elide.jmod", version.ref = "elide-infra" }
build.gradle.kts
(using a Version Catalog):
plugins {
alias(libs.plugins.jmod)
}
The plug-in adds the jmod
task, which builds an artifact at <project>/build/jmod/<name>.jmod
. You can easily run the
task with ./gradlew jmod
. The added jmod
task attaches to build
, so ./gradlew build
will also produce the
artifact.
To configure the task:
build.gradle.kts
jmod {
// See table of configuration properties.
}
tasks.jmod {
// The individual task can also be configured like any Exec task.
argumentProviders.add(CommandLineArgumentProvider {
listOf("--more-arguments-to-jmod")
})
}
Coming soon; no properties are exposed at this time, aside from the standard Exec interface.