Gradle plugin for jpackage tool available in JDK-14.
This plugin will try to use jpackage
executable from path specified by java.home
system property.
There are generic parameters as well as OS-specific parameters for OS X, Linux, Windows.
Plugin determines OS name using os.name
system property in order to configure OS-specific parameters.
OS-specific parameters should be conditionally specified for each required OS.
Example:
mac {
icon = "icons/icons.icns"
}
windows {
icon = "icons/icons.ico"
winMenu = true
winDirChooser = true
}
Parameter | JPackage Argument |
---|---|
type | --type <type> |
appName | --name <name> |
appVersion | --app-version <version> |
destination | --dest <destination path> |
copyright | --copyright <copyright string> |
appDescription | --description <description string> |
vendor | --vendor <vendor string> |
runtimeImage | --runtime-image <file path> |
input | --input <input path> |
installDir | --install-dir <file path> |
module | --module <module name>[/<main class>] |
modulePath | --module-path <module path>... |
mainClass | --main-class <class name> |
mainJar | --main-jar <main jar file> |
icon | --icon <icon file path> |
verbose | --verbose |
arguments | --arguments <main class arguments> |
Parameter | jpackage argument |
---|---|
winMenu | --win-menu |
winDirChooser | --win-dir-chooser |
winUpgradeUuid | --win-upgrade-uuid <id string> |
winMenuGroup | --win-menu-group <menu group name> |
winShortcut | --win-shortcut |
winPerUserInstall | --win-per-user-install |
Parameter | jpackage argument |
---|---|
macPackageIdentifier | --mac-package-identifier <ID string> |
macPackageName | --mac-package-name <name string> |
macPackageSigningPrefix | --mac-package-signing-prefix <prefix string> |
macSign | --mac-sign |
macSigningKeychain | --mac-signing-keychain <file path> |
macSigningKeyUserName | --mac-signing-key-user-name <team name> |
Parameter | jpackage argument |
---|---|
linuxPackageName | --linux-package-name <package name> |
linuxDebMaintainer | --linux-deb-maintainer <email address> |
linuxMenuGroup | --linux-menu-group <menu-group-name> |
linuxRpmLicenseType | --linux-rpm-license-type <type string> |
linuxAppRelease | --linux-app-release <release value> |
linuxAppCategory | --linux-app-category <category value> |
linuxShortcut | --linux-shortcut |
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 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\""
)
task("copyDependencies", Copy::class) {
from(configurations.runtimeClasspath).into("$buildDir/jmods")
}
tasks.withType<org.panteleyev.jpackage.JPackageTask> {
dependsOn("build")
dependsOn("copyDependencies")
appName = "Application Name"
appVersion = project.version as String
vendor = "app.org"
copyright = "Copyright (c) 2020 Vendor"
runtimeImage = System.getProperty("java.home")
module = "org.app.module/org.app.MainClass"
modulePath = "$buildDir/jmods"
destination = "$buildDir/dist"
javaOptions = listOf(
"--enable-preview",
"-Dfile.encoding=UTF-8"
)
mac {
icon = "icons/icons.icns"
}
windows {
icon = "icons/icons.ico"
winMenu = true
winDirChooser = true
}
}