jpackage-gradle-plugin
jpackage-gradle-plugin copied to clipboard
JPackage Gradle Plugin
JPackage Gradle Plugin
Gradle plugin for jpackage tool available since JDK-14.
Finding jpackage
Plugin searches for jpackage executable using the following priority list:
-
Configured toolchain
-
java.homesystem property.
Configuration
There are generic jpackage parameters as well as OS-specific parameters for OS X, Linux, Windows.
OS-specific parameters are processed when build is done on the corresponding OS.
If some generic parameters should have different values based on OS then they should be placed into configuration blocks:
- windows
- mac
- linux
Example:
// Windows specific parameters will be processed only during Windows build
winMenu = true
winDirChooser = true
mac {
// Generic parameter value for OS X build
icon = "icons/icons.icns"
}
windows {
// Generic parameter value for Windows build
icon = "icons/icons.ico"
}
Parameters
| Parameter | Type | JPackage Argument | Min Version | Max Version |
|---|---|---|---|---|
| Generic | ||||
| aboutUrl | String | --about-url <url> | 17 | * |
| addModules | List<String> | --add-modules <module>[,<module>] | 14 | * |
| appDescription | String | --description <description string> | 14 | * |
| appContent | List<String> (*) | --app-content additional-content[,additional-content...] | 18 | * |
| appImage | String (*) | --app-image <name> | 14 | * |
| appName | String | --name <name> | 14 | * |
| appVersion | String | --app-version <version> | 14 | * |
| arguments | List<String> | --arguments <main class arguments> | 14 | * |
| bindServices | Boolean | --bind-services | 14 | 15 |
| copyright | String | --copyright <copyright string> | 14 | * |
| destination | String (*) | --dest <destination path> | 14 | * |
| fileAssociations | List<String> (*) | --file-associations <file association property file> | 14 | * |
| icon | String (*) | --icon <icon file path> | 14 | * |
| input | String (*) | --input <input path> | 14 | * |
| installDir | String | --install-dir <file path> | 14 | * |
| javaOptions | List<String> | --java-options <options> | 14 | * |
| jLinkOptions | List<String> | --jlink-options <options> | 16 | * |
| launchers | List<Launcher> (*) | --add-launcher <name>=<property file> | 14 | * |
| launcherAsService | Boolean | --launcher-as-service | 19 | * |
| licenseFile | String (*) | --license-file <license file path> | 14 | * |
| mainClass | String | --main-class <class name> | 14 | * |
| mainJar | String | --main-jar <main jar file> | 14 | * |
| module | String | --module <module name>[/<main class>] | 14 | * |
| modulePaths | List<String> (*) | --module-path <module path> | 14 | * |
| resourceDir | String (*) | --resource-dir <resource dir path> | 14 | * |
| runtimeImage | String (*) | --runtime-image <file path> | 14 | * |
| temp | String (*) | --temp <temp dir path> | 14 | * |
| type | ImageType | --type <type> | 14 | * |
| vendor | String | --vendor <vendor string> | 14 | * |
| verbose | Boolean | --verbose | 14 | * |
| Windows | ||||
| winConsole | Boolean | --win-console | 14 | * |
| winDirChooser | Boolean | --win-dir-chooser | 14 | * |
| winHelpUrl | String | --win-help-url <url> | 17 | * |
| winMenu | Boolean | --win-menu | 14 | * |
| winMenuGroup | String | --win-menu-group <menu group name> | 14 | * |
| winPerUserInstall | Boolean | --win-per-user-install | 14 | * |
| winShortcut | Boolean | --win-shortcut | 14 | * |
| winShortcutPrompt | Boolean | --win-shortcut-prompt | 17 | * |
| winUpdateUrl | String | --win-update-url <url> | 17 | * |
| winUpgradeUuid | String | --win-upgrade-uuid <id string> | 14 | * |
| OS X | ||||
| macAppCategory | String | -mac-app-category <category string> | 17 | * |
| macAppStore | Boolean | --mac-app-store | 17 | * |
| macBundleSigningPrefix | String | --mac-bundle-signing-prefix <prefix string> | 14 | 16 |
| macDmgContent | List<String> (*) | --mac-dmg-content additional-content[,additional-content...] | 18 | * |
| macEntitlements | String (*) | --mac-entitlements <file path> | 17 | * |
| macPackageIdentifier | String | --mac-package-identifier <ID string> | 14 | * |
| macPackageName | String | --mac-package-name <name string> | 14 | * |
| macPackageSigningPrefix | String | --mac-package-signing-prefix <prefix string> | 17 | * |
| macSign | Boolean | --mac-sign | 14 | * |
| macSigningKeychain | String (*) | --mac-signing-keychain <file path> | 14 | * |
| macSigningKeyUserName | String | --mac-signing-key-user-name <team name> | 14 | * |
| Linux | ||||
| linuxAppCategory | String | --linux-app-category <category value> | 14 | * |
| linuxAppRelease | String | --linux-app-release <release value> | 14 | * |
| linuxDebMaintainer | String | --linux-deb-maintainer <email address> | 14 | * |
| linuxMenuGroup | String | --linux-menu-group <menu-group-name> | 14 | * |
| linuxPackageName | String | --linux-package-name <package name> | 14 | * |
| linuxPackageDeps | Boolean | --linux-package-deps | 14 | * |
| linuxRpmLicenseType | String | --linux-rpm-license-type <type string> | 14 | * |
| linuxShortcut | Boolean | --linux-shortcut | 14 | * |
(*) - these parameters represent file or directory path and are resolved relative to the project root unless they contain an absolute path.
Image Type
| Plugin Value | JPackage Type |
|---|---|
| DEFAULT | Default image type, OS specific |
| APP_IMAGE | app-image |
| DMG | dmg |
| PKG | pkg |
| EXE | exe |
| MSI | msi |
| RPM | rpm |
| DEB | deb |
Default Command-Line Arguments
Default command line arguments are passed to the main class when the application is started without providing arguments.
Example:
arguments = listOf(
"SomeArgument",
"Argument with spaces",
"Argument with \"quotes\""
)
JVM Options
Options that are passed to the JVM when the application is started.
Example:
javaOptions = listOf(
"-Xms2m",
"-Xmx10m"
)
jlink options
Options that are passed to underlying jlink call.
Example:
jLinkOptions = listOf(
"--strip-native-commands",
"--strip-debug"
)
jpackage Environment Variables
Optionally environment variables can be passed to jpackage executable process.
Example:
jpackageEnvironment = mapOf(
"GRADLE_DIR" to project.projectDir.absolutePath,
"BUILD_DIR" to project.buildDir.absolutePath
)
null values as well as null or empty keys are ignored.
Logging
Plugin uses LogLevel.INFO to print various information about toolchain, jpackage parameters, etc. Use gradle
option --info to check this output.
Dry Run Mode
To execute plugin tasks in dry run mode without calling jpackage set propertyjpackage.dryRun to true.
Example:
$ ./gradlew clean build jpackage --info -Djpackage.dryRun=true
Configuration Cache
This plugin is not compatible with Gradle configuration cache.
Examples
- Modular Application with Full Runtime
- Non-Modular Application