/jpackage-gradle-plugin

JPackage Gradle Plugin

Primary LanguageJavaBSD 2-Clause "Simplified" LicenseBSD-2-Clause

JPackage Gradle Plugin

Gradle plugin for jpackage tool available since JDK-14.

Gradle Plugin Portal Gradle Java BSD-2 license

Finding jpackage

Plugin searches for jpackage executable using the following priority list:

  1. Configured toolchain

  2. 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

ParameterTypeJPackage Argument
Generic
typeImageType--type <type>
appNameString--name <name>
appVersionString--app-version <version>
copyrightString--copyright <copyright string>
appDescriptionString--description <description string>
vendorString--vendor <vendor string>
installDirString--install-dir <file path>
moduleString--module <module name>[/<main class>]
mainClassString--main-class <class name>
mainJarString--main-jar <main jar file>
verboseString--verbose
argumentsString--arguments <main class arguments>
addModulesString--add-modules <module>[,<module>]
appImageString (*)--app-image <name>
destinationString (*)--dest <destination path>
fileAssociationsString (*)--file-associations <file association property file>
iconString (*)--icon <icon file path>
inputString (*)--input <input path>
licenseFileString (*)--license-file <license file path>
modulePathsString (*)--module-path <module path>
resourceDirString (*)--resource-dir <resource dir path>
runtimeImageString (*)--runtime-image <file path>
tempString (*)--temp <temp dir path>
launchersLauncher (*)--add-launcher <name>=<property file>
Windows
winMenuBoolean--win-menu
winDirChooserBoolean--win-dir-chooser
winUpgradeUuidString--win-upgrade-uuid <id string>
winMenuGroupString--win-menu-group <menu group name>
winShortcutBoolean--win-shortcut
winPerUserInstallBoolean--win-per-user-install
winConsoleBoolean--win-console
OS X
macPackageIdentifierString--mac-package-identifier <ID string>
macPackageNameString--mac-package-name <name string>
macPackageSigningPrefixString--mac-package-signing-prefix <prefix string>
macSignBoolean--mac-sign
macSigningKeychainString (*)--mac-signing-keychain <file path>
macSigningKeyUserNameString--mac-signing-key-user-name <team name>
Linux
linuxPackageNameString--linux-package-name <package name>
linuxDebMaintainerString--linux-deb-maintainer <email address>
linuxMenuGroupString--linux-menu-group <menu-group-name>
linuxRpmLicenseTypeString--linux-rpm-license-type <type string>
linuxAppReleaseString--linux-app-release <release value>
linuxAppCategoryString--linux-app-category <category value>
linuxShortcutBoolean--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

Examples

References

Packaging Tool User's Guide