jpackage-gradle-plugin

0
README.md

JPackage Gradle Plugin

Gradle plugin for jpackage tool.

License Gradle Plugin Portal Gradle JDK

Finding jpackage

Plugin searches for

jpackage
executable using the following priority list:

  1. Configured toolchain

  2. java.home
    system property.

Though rarely required it is possible to override toolchain for particular

jpackage
task:

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:

Parameters

ParameterTypeJPackage ArgumentMin VersionMax Version
Generic
aboutUrlProperty<String>--about-url <url>17*
addModulesListProperty<String>--add-modules <module>[,<module>]14*
appDescriptionProperty<String>--description <description string>14*
appContentConfigurableFileCollection--app-content additional-content[,additional-content...]18*
appImageProperty<String>--app-image <name>14*
appNameProperty<String>--name <name>14*
appVersionProperty<String>--app-version <version>14*
argumentsListProperty<String>--arguments <main class arguments>14*
copyrightProperty<String>--copyright <copyright string>14*
destinationDirectoryProperty--dest <destination path>14*
fileAssociationsConfigurableFileCollection--file-associations <file association property file>14*
iconRegularFileProperty--icon <icon file path>14*
inputDirectoryProperty--input <input path>14*
installDirProperty<String>--install-dir <file path>14*
javaOptionsListProperty<String>--java-options <options>14*
jLinkOptionsListProperty<String>--jlink-options <options>16*
launchersListProperty<Launcher>--add-launcher <name>=<property file>14*
launcherAsServiceProperty<Boolean>--launcher-as-service19*
licenseFileRegularFileProperty--license-file <license file path>14*
mainClassProperty<String>--main-class <class name>14*
mainJarProperty<String>--main-jar <main jar file>14*
moduleProperty<String>--module <module name>[/<main class>]14*
modulePathsConfigurableFileCollection--module-path <module path>14*
resourceDirDirectoryProperty--resource-dir <resource dir path>14*
runtimeImageDirectoryProperty--runtime-image <file path>14*
tempDirectoryProperty--temp <temp dir path>14*
typeProperty<ImageType>--type <type>14*
vendorProperty<String>--vendor <vendor string>14*
verboseProperty<Boolean>--verbose14*
Windows
winConsoleProperty<Boolean>--win-console14*
winDirChooserProperty<Boolean>--win-dir-chooser14*
winHelpUrlProperty<String>--win-help-url <url>17*
winMenuProperty<Boolean>--win-menu14*
winMenuGroupProperty<String>--win-menu-group <menu group name>14*
winPerUserInstallProperty<Boolean>--win-per-user-install14*
winShortcutProperty<Boolean>--win-shortcut14*
winShortcutPromptProperty<Boolean>--win-shortcut-prompt17*
winUpdateUrlProperty<String>--win-update-url <url>17*
winUpgradeUuidProperty<String>--win-upgrade-uuid <id string>14*
OS X
macAppCategoryProperty<String>--mac-app-category <category string>17*
macAppStoreProperty<Boolean>--mac-app-store17*
macBundleSigningPrefixProperty<String>--mac-bundle-signing-prefix <prefix string>1416
macDmgContentConfigurableFileCollection--mac-dmg-content additional-content[,additional-content...]18*
macEntitlementsRegularFileProperty--mac-entitlements <file path>17*
macPackageIdentifierProperty<String>--mac-package-identifier <ID string>14*
macPackageNameProperty<String>--mac-package-name <name string>14*
macPackageSigningPrefixProperty<String>--mac-package-signing-prefix <prefix string>17*
macSignProperty<Boolean>--mac-sign14*
macSigningKeychainProperty<String>--mac-signing-keychain <keychain name>14*
macSigningKeyUserNameProperty<String>--mac-signing-key-user-name <team name>14*
Linux
linuxAppCategoryProperty<String>--linux-app-category <category value>14*
linuxAppReleaseProperty<String>--linux-app-release <release value>14*
linuxDebMaintainerProperty<String>--linux-deb-maintainer <email address>14*
linuxMenuGroupProperty<String>--linux-menu-group <menu-group-name>14*
linuxPackageNameProperty<String>--linux-package-name <package name>14*
linuxPackageDepsProperty<String>--linux-package-deps <package-dep-string>14*
linuxRpmLicenseTypeProperty<String>--linux-rpm-license-type <type string>14*
linuxShortcutProperty<Boolean>--linux-shortcut14*

Since version

1.7.0
the plugin does not check if parameter is applicable to
jpackage
tool version. Users are advised to consult the corresponding User's Guide.

Image Type

Plugin ValueJPackage Type
DEFAULTDefault image type, OS specific
APP_IMAGEapp-image
DMGdmg
PKGpkg
EXEexe
MSImsi
RPMrpm
DEBdeb

Launchers

Launchers are defines using class

Launcher
:

Destination Directory

jpackage
utility fails if output directory already exists. At the same time gradle always creates plugin output directory.

In order to work around this behaviour plugin always tries to delete directory specified by

destination
before launching
jpackage
.

For safety reasons

destination
must point to the location inside
${layout.buildDirectory}
.

Example:

Default Command-Line Arguments

Default command line arguments are passed to the main class when the application is started without providing arguments.

Example:

JVM Options

Options that are passed to the JVM when the application is started.

Example:

Options that are passed to underlying jlink call.

Example:

jpackage Environment Variables

Optionally environment variables can be passed to

jpackage
executable process.

Example:

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 property
jpackage.dryRun
to true.

Example:

Configuration Cache

This plugin should be compatible with Gradle configuration cache.

Examples

References

Packaging Tool User's Guide