Skip to content

spacious-team/jpackage-maven-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JPackage Maven Plugin

Maven plugin for jpackage tool available in JDK-14.

BSD-2 license Maven Central

Usage

This plugin expects maven-toolchains-plugin configured in the project. Toolchain "jdk" will be queried for tool = "jpackage". If jpackage cannot be found using toolchain then plugin will try to use 'jpackage' executable from path specified by java.home system property.

Configuration

There are generic parameters as well as OS-specific parameters for OS X and Windows. Plugin determines OS name using os.name system property in order to configure OS-specific parameters.

Generic parameters should be placed in the root plugin configuration. OS-specific parameters should be separated via executions. Id of the executions are irrelevant however using OS names improves usability.

Example:

<executions>
    <execution>
        <id>mac</id>
        <configuration>
            <icon>icons/icons.icns</icon>
        </configuration>
    </execution>
    <execution>
        <id>win</id>
        <configuration>
            <icon>icons/icon.ico</icon>
            <winMenu>true</winMenu>
        </configuration>
    </execution>
</executions>

With above execution configuration the following command lines can be used:

  • for OS X package: mvn jpackage:jpackage@mac
  • for Windows package: mvn jpackage:jpackage@win

Generic Parameters

Parameter JPackage Argument
type --type <type>
name --name <name>
appVersion --app-version <version>
destination --dest <destination path>
copyright --copyright <copyright string>
description --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>

Windows Specific Parameters

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

OS X Specific Parameters

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>

Linux Specific Parameters

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

Image Type

Plugin Value JPackage Type
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:

<arguments>
    <argument>SomeArgument</argument>
    <argument>Argument with spaces</argument>
    <argument>Argument with "quotes"</argument>
</arguments>

Samples

Application image with full JRE

<plugin>
    <groupId>org.panteleyev</groupId>
    <artifactId>jpackage-maven-plugin</artifactId>
    <version>0.0.1</version>

    <configuration>
        <name>Application Name</name>
        <appVersion>${project.version}</appVersion>
        <vendor>app.org</vendor>
        <runtimeImage>${java.home}</runtimeImage>
        <module>${appModule}/${appMainClass}</module>
        <modulePath>target/mods</modulePath>
        <destination>target/dist</destination>
        <javaOptions>
            <option>--enable-preview</option>
            <option>-Dfile.encoding=UTF-8</option>
        </javaOptions>
    </configuration>

    <executions>
        <execution>
            <id>mac</id>
            <configuration>
                <icon>icons/icons.icns</icon>
            </configuration>
        </execution>
        <execution>
            <id>win</id>
            <configuration>
                <icon>icons/icon.ico</icon>
                <winMenu>true</winMenu>
            </configuration>
        </execution>
    </executions>
</plugin>

References

Packaging Tool User's Guide

Packages

No packages published

Languages

  • Java 100.0%