Class JPackageExtension
java.lang.Object
io.github.danlewis783.jpackage.JPackageExtension
Configuration for packaging a Java application with the
jpackage tool.
jpackage {
appName = "MyApp"
mainClass = "com.example.Main"
icon = layout.projectDirectory.file("packaging/myapp.ico")
docFiles.from("README.md", "LICENSE")
installer {
types = ["msi"]
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.ListProperty<String> Modules linked into the generated runtime image (--add-modules).abstract org.gradle.api.provider.Property<String> Application name; also the launcher name.abstract org.gradle.api.provider.Property<String> Application version.abstract org.gradle.api.provider.ListProperty<String> Default command-line arguments passed to the main class (--arguments).abstract org.gradle.api.provider.Property<String> Copyright string embedded in the application.abstract org.gradle.api.provider.Property<String> Description shown in the app metadata and installers.abstract org.gradle.api.file.DirectoryPropertyLocal directory thatjpackageInstallcopies the application image into, for developer self-use without an installer.abstract org.gradle.api.file.ConfigurableFileCollectionDocumentation files (README, LICENSE, manuals, ...) copied into the root of the application image.abstract org.gradle.api.provider.ListProperty<String> Extra arguments appended verbatim to the app-image jpackage invocation.abstract org.gradle.api.file.RegularFilePropertygetIcon()Launcher icon (.icoon Windows,.icnson macOS,.pngon Linux).Native installer options used by thejpackageInstallertask.abstract org.gradle.api.provider.ListProperty<String> JVM options baked into the launcher (--java-options).abstract org.gradle.api.provider.ListProperty<String> Options passed to jlink when the runtime image is generated (--jlink-options).abstract org.gradle.api.provider.Property<Integer> Java major version of the JDK toolchain whosejpackagetool is used.abstract org.gradle.api.provider.Property<String> Fully qualified main class of the application.abstract org.gradle.api.provider.Property<String> File name of the main jar within the packaged input.abstract org.gradle.api.file.DirectoryPropertyDirectory of resources that override jpackage defaults (--resource-dir).abstract org.gradle.api.file.DirectoryPropertyA pre-built runtime image to bundle instead of one produced by jlink.abstract org.gradle.api.provider.Property<String> Vendor shown in the app metadata and installers.abstract org.gradle.api.provider.Property<Boolean> Passes--verboseto jpackage.abstract org.gradle.api.provider.Property<Boolean> Whentrueon Windows, the launcher opens a console window and connects stdio.voidinstaller(org.gradle.api.Action<? super InstallerOptions> action) Configures the native installer options.
-
Constructor Details
-
JPackageExtension
@Inject public JPackageExtension(org.gradle.api.model.ObjectFactory objects)
-
-
Method Details
-
getAppName
Application name; also the launcher name. Defaults to the project name. -
getAppVersion
Application version. Defaults to the project version, or1.0.0when the project version is unspecified. Windows installers require a numericx.y.zversion. -
getMainClass
Fully qualified main class of the application. Required. -
getMainJar
File name of the main jar within the packaged input. Defaults to the archive file name of thejartask. -
getVendor
Vendor shown in the app metadata and installers. -
getDescription
Description shown in the app metadata and installers. -
getCopyright
Copyright string embedded in the application. -
getIcon
public abstract org.gradle.api.file.RegularFileProperty getIcon()Launcher icon (.icoon Windows,.icnson macOS,.pngon Linux). -
getWinConsole
Whentrueon Windows, the launcher opens a console window and connects stdio. Use for command-line applications. Defaults tofalse. -
getJavaOptions
JVM options baked into the launcher (--java-options). -
getArguments
Default command-line arguments passed to the main class (--arguments). -
getDocFiles
public abstract org.gradle.api.file.ConfigurableFileCollection getDocFiles()Documentation files (README, LICENSE, manuals, ...) copied into the root of the application image. They end up in the zip, the dev install, and the installers. -
getJpackageJdkVersion
Java major version of the JDK toolchain whosejpackagetool is used. Defaults to the JVM running the build. This is independent of the Java version your application targets. -
getRuntimeImage
public abstract org.gradle.api.file.DirectoryProperty getRuntimeImage()A pre-built runtime image to bundle instead of one produced by jlink. Use this to ship a Java 8 JRE with an application that must run on exactly that runtime. Cannot be combined withaddModulesorjlinkOptions. -
getAddModules
Modules linked into the generated runtime image (--add-modules). When empty, jpackage links its default module set, which is large; listing only what you need (for example["java.desktop", "java.sql"]) makes the image much smaller. -
getJlinkOptions
Options passed to jlink when the runtime image is generated (--jlink-options). -
getResourceDir
public abstract org.gradle.api.file.DirectoryProperty getResourceDir()Directory of resources that override jpackage defaults (--resource-dir). On Windows this is wheremain.wxs,overrides.wxi, WiX fragment overrides, and<AppName>-post-image.wsfgo — the hook for registry entries and custom install-time actions. -
getExtraArgs
Extra arguments appended verbatim to the app-image jpackage invocation. -
getVerbose
Passes--verboseto jpackage. Defaults tofalse. -
getDevInstallDirectory
public abstract org.gradle.api.file.DirectoryProperty getDevInstallDirectory()Local directory thatjpackageInstallcopies the application image into, for developer self-use without an installer. Defaults to<user home>/apps/<appName>. The task synchronizes the directory: files not part of the image are removed. -
getInstaller
Native installer options used by thejpackageInstallertask. -
installer
Configures the native installer options.
-