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.home
system 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 |
---|---|---|
Generic | ||
type | ImageType | --type <type> |
appName | String | --name <name> |
appVersion | String | --app-version <version> |
copyright | String | --copyright <copyright string> |
appDescription | String | --description <description string> |
vendor | String | --vendor <vendor string> |
installDir | String | --install-dir <file path> |
module | String | --module <module name>[/<main class>] |
mainClass | String | --main-class <class name> |
mainJar | String | --main-jar <main jar file> |
verbose | Boolean | --verbose |
arguments | String | --arguments <main class arguments> |
addModules | String | --add-modules <module>[,<module>] |
appImage | String (*) | --app-image <name> |
destination | String (*) | --dest <destination path> |
fileAssociations | String (*) | --file-associations <file association property file> |
icon | String (*) | --icon <icon file path> |
input | String (*) | --input <input path> |
licenseFile | String (*) | --license-file <license file path> |
modulePaths | String (*) | --module-path <module path> |
resourceDir | String (*) | --resource-dir <resource dir path> |
runtimeImage | String (*) | --runtime-image <file path> |
temp | String (*) | --temp <temp dir path> |
launchers | Launcher (*) | --add-launcher <name>=<property file> |
Windows | ||
winMenu | Boolean | --win-menu |
winDirChooser | Boolean | --win-dir-chooser |
winUpgradeUuid | String | --win-upgrade-uuid <id string> |
winMenuGroup | String | --win-menu-group <menu group name> |
winShortcut | Boolean | --win-shortcut |
winPerUserInstall | Boolean | --win-per-user-install |
winConsole | Boolean | --win-console |
OS X | ||
macPackageIdentifier | String | --mac-package-identifier <ID string> |
macPackageName | String | --mac-package-name <name string> |
macPackageSigningPrefix | String | --mac-package-signing-prefix <prefix string> |
macSign | Boolean | --mac-sign |
macSigningKeychain | String (*) | --mac-signing-keychain <file path> |
macSigningKeyUserName | String | --mac-signing-key-user-name <team name> |
Linux | ||
linuxPackageName | String | --linux-package-name <package name> |
linuxDebMaintainer | String | --linux-deb-maintainer <email address> |
linuxMenuGroup | String | --linux-menu-group <menu-group-name> |
linuxRpmLicenseType | String | --linux-rpm-license-type <type string> |
linuxAppRelease | String | --linux-app-release <release value> |
linuxAppCategory | String | --linux-app-category <category value> |
linuxShortcut | Boolean | --linux-shortcut |
(*) - 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. Each argument should be specified using <argument> configuration parameter.
Example:
argumens = listOf(
"SomeArgument",
"Argument with spaces",
"Argument with \"quotes\""
)
Additional Parameters
Additional parameters allow passing jpackage
command line options not supported by the plugin. These parameters are passed as is without any transformation.
Example:
additionalParameters = listOf(
"--jlink-options",
"--bind-services"
)
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