A Gradle plugin to package modular Java application as standalone bundles/installers for Windows, macOS and Linux with jpackage.
This plugin is maintained by me, Jendrik Johannes. I offer consulting and training for Gradle and/or the Java Module System - please reach out if you are interested. There is also my YouTube channel on Gradle topics.
If you have a suggestion or a question, please open an issue.
If you plan to build Java Modules with Gradle, you should consider using these plugins on top of Gradle core:
id("org.gradlex.java-module-dependencies")
Avoid duplicated dependency definitions and get your Module Path under controlid("org.gradlex.java-module-testing")
Proper test setup for Java Modulesid("org.gradlex.extra-java-module-info")
Only if your (existing) project cannot avoid using non-module legacy Jarsid("org.gradlex.java-module-packaging")
Package standalone applications for Windows, macOS and Linux
Here is a sample that shows all plugins in combination.
In episodes 31, 32, 33 of Understanding Gradle I explain what these plugins do and why they are needed.
Full Java Module System Project Setup is a full-fledged Java Module System project setup using these plugins.
For general information about how to structure Gradle builds and apply community plugins like this one to all subprojects you can check out my Understanding Gradle video series.
Add this to the build file of your convention plugin's build
(e.g. build-logic/build.gradle(.kts)
or buildSrc/build.gradle(.kts)
).
dependencies {
implementation("org.gradlex:java-module-packaging:0.1")
}
In your convention plugin, apply the plugin and configure the targets.
plugins {
id("org.gradlex.java-module-packaging")
}
javaModulePackaging {
target("windows") {
operatingSystem = "windows"
architecture = "x86-64"
}
target("ubuntu") {
operatingSystem = "linux"
architecture = "x86-64"
}
target("macos") {
operatingSystem = "macos"
architecture = "x86-64"
}
target("macosM1") {
operatingSystem = "macos"
architecture = "aarch64"
}
}
You can now run target specific builds:
./gradlew assembleWindows
Gradle and the Gradle logo are trademarks of Gradle, Inc. The GradleX project is not endorsed by, affiliated with, or associated with Gradle or Gradle, Inc. in any way.