jpacktool:jlink

Full name:

net.agilhard.maven.plugins:jpacktool-maven-plugin:1.0.0-SNAPSHOT:jlink

Description:

The JLink goal is intended to create a Java Run Time Image file based on http://openjdk.java.net/jeps/282, http://openjdk.java.net/jeps/220. This extends the base class by some features for update4j.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: runtime.
  • Binds by default to the lifecycle phase: package.

Optional Parameters

Name Type Since Description
<addJDKToLimitModules> boolean - Toggle whether to add all modules in the java boot path to the limitModules setting.
Default value is: false.
<addModules> List -

Usually this is not necessary, cause this is handled automatically by the given dependencies.

By using the --add-modules you can define the root modules to be resolved. The configuration in pom.xml file can look like this:

<addModules>
  <addModule>mod1</addModule>
  <addModule>first</addModule>
  .
  .
</addModules>

The command line equivalent for jlink is: --add-modules <mod>[,<mod>...].


<appFolderName> String - Name of the "app" folder.
Default value is: app.
<arguments> List - Command line arguments to pass to the main class if no arguments are specified by the launcher.

--arguments <args>


<automaticModulesFolderName> String - Name of the automatic-modules folder
Default value is: jar_auto.
<basePath> String - The update4j basePath
<basePathBelowHomeDir> boolean - Flag if the basePath setting is relativ to ${user.home}
Default value is: false.
<basePathBelowUserDir> boolean - Flag if the basePath setting is relativ to ${user.dir}
Default value is: true.
<baseUri> String - The update4j baseUri
<bindServices> boolean - Add the option --bind-services or not.
Default value is: false.
<classPathFolderName> String - Name of the classpath folder
Default value is: jar.
<classpathArtifacts> List - Artifacts that should be explicitly on the classpath
<compress> Integer - Here you can define the compression of the resources being used. The command line equivalent is: -c, --compress=level>. The valid values for the level are: 0, 1, 2.
<disablePlugin> String - You can disable a plugin by using this option. --disable-plugin pluginName.
<endian> String - The byte order of the generated Java Run Time image. --endian <little|big>. If the endian is not given the default is: native.
<excludedArtifacts> List - Artifacts that should be excluded
<generateUpdate4jConfig> boolean - Set if to generate an update4j config file
Default value is: true.
<ignoreAutomaticModules> boolean - Flag to ignore automatic modules.
Default value is: true.
<ignoreSigningInformation> boolean - --ignore-signing-information
Default value is: false.
<jPacktoolMoveAutomaticModules> boolean - Flag if to move real modules from jpacktool-prepare goal
Default value is: true.
<jPacktoolMoveClassPathJars> boolean - Flag if to move classpath jars from jpacktool-prepare goal
Default value is: true.
<jPacktoolMoveRealModules> boolean - Flag if to move real modules from jpacktool-prepare goal. This can not be set to true when using jpackager because jpackager explicitly disallows modules in input directories.
Default value is: false.
<jdkToolchain> Map -

Specify the requirements for this jdk toolchain. This overrules the toolchain selected by the maven-toolchain-plugin.

note: requires at least Maven 3.3.1
<jpacktoolProperties> File - The jpacktool.properties file
<jvmArgs> List - JVM flags and options to pass to the application.

--jvm-args <args>


<launcher> String - Should the plugin generate a launcher script by means of jlink? The command line equivalent is: --launcher <name>=<module>[/<mainclass>]. The valid values for the level are: <name>=<module>[/<mainclass>].
<launcherTemplate> String - Should the plugin generate a launcher script by means of its own template mechanism.

Can contain either the value "default" or a resource: URL or a path to a file.

The Freemarker Java Template Engine is used for the template.


Default value is: default.
<launcherTemplateScript> String - Name of the script generated from launcherTemplate
<launcherTemplateScriptLinux> String - Name of the script generated from launcherTemplate for linux
Default value is: start.sh.
<launcherTemplateScriptMac> String - Name of the script generated from launcherTemplate for mac
Default value is: start.sh.
<launcherTemplateScriptWindows> String - Name of the script generated from launcherTemplate for windows
Default value is: start.ps1.
<limitModules> List - Limit the universe of observable modules. The following gives an example of the configuration which can be used in the pom.xml file.
  <limitModules>
    <limitModule>mod1</limitModule>
    <limitModule>xyz</limitModule>
    .
    .
  </limitModules>

This configuration is the equivalent of the command line option: --limit-modules <mod>[,<mod>...]


<mainClass> String - main class for script Generation
<mainJar> String - main jar for script Generation
<mainModule> String - main module for script Generation
<modulePaths> List - Include additional paths on the --module-path option. Project dependencies and JDK modules are automatically added.
<modulesFolderName> String - Name of the modules folder
Default value is: jmods.
<noHeaderFiles> boolean - This will suppress to have an includes directory in the resulting Java Run Time Image. The JLink command line equivalent is: --no-header-files
Default value is: false.
<noManPages> boolean - This will suppress to have the man directory in the resulting Java Run Time Image. The JLink command line equivalent is: --no-man-pages
Default value is: false.
<packagingResources> PackagingResources - Resources to package into the image or installable package.

You can use almost any configuration option that the Apache Maven Resources Plugin has on this setting.

When filtering is set to true on a resource the Freemarker Java Template Engine is being used to filter the contents and some variables set by the packaging process are available to it.

Hava a look at the Template Author's Guide for details on how to write templates.


<pluginModulePath> String - Define the plugin module path to be used. There can be defined multiple entries separated by either ; or :. The jlink command line equivalent is: --plugin-module-path <modulepath>
<skip> boolean - skip plugin execution.
Default value is: false.
<sourceJdkModules> File - Set the JDK location to create a Java custom runtime image.
<splashScreenOptions> SplashScreenOptions - Options for the SplashScreen
<stripConfigName> String - replace this with nothing in the name of the config file
Default value is: -jpacktool.
<stripDebug> boolean - This is intended to strip debug information out. The command line equivalent of jlink is: -G, --strip-debug strip debug information.
Default value is: false.
<suggestProviders> List - Suggest providers that implement the given service types from the module path.
<suggestProviders>
  <suggestProvider>name-a</suggestProvider>
  <suggestProvider>name-b</suggestProvider>
  .
  .
</suggestProviders>
The jlink command line equivalent: --suggest-providers [<name>,...]
<unfilteredDependencyHandling> boolean - Fall back to using old unfiltered maven dependency handling.
Default value is: false.
<verbose> boolean - This will turn on verbose mode.

The jlink/jpackager command line equivalent is: --verbose


Default value is: false.

Parameter Details

<addJDKToLimitModules>

Toggle whether to add all modules in the java boot path to the limitModules setting.
  • Type: boolean
  • Required: No
  • Default: false

<addModules>

Usually this is not necessary, cause this is handled automatically by the given dependencies.

By using the --add-modules you can define the root modules to be resolved. The configuration in pom.xml file can look like this:

<addModules>
  <addModule>mod1</addModule>
  <addModule>first</addModule>
  .
  .
</addModules>

The command line equivalent for jlink is: --add-modules <mod>[,<mod>...].

  • Type: java.util.List
  • Required: No

<appFolderName>

Name of the "app" folder.
  • Type: java.lang.String
  • Required: No
  • Default: app

<arguments>

Command line arguments to pass to the main class if no arguments are specified by the launcher.

--arguments <args>

  • Type: java.util.List
  • Required: No

<automaticModulesFolderName>

Name of the automatic-modules folder
  • Type: java.lang.String
  • Required: No
  • Default: jar_auto

<basePath>

The update4j basePath
  • Type: java.lang.String
  • Required: No

<basePathBelowHomeDir>

Flag if the basePath setting is relativ to ${user.home}
  • Type: boolean
  • Required: No
  • Default: false

<basePathBelowUserDir>

Flag if the basePath setting is relativ to ${user.dir}
  • Type: boolean
  • Required: No
  • Default: true

<baseUri>

The update4j baseUri
  • Type: java.lang.String
  • Required: No

<bindServices>

Add the option --bind-services or not.
  • Type: boolean
  • Required: No
  • Default: false

<classPathFolderName>

Name of the classpath folder
  • Type: java.lang.String
  • Required: No
  • Default: jar

<classpathArtifacts>

Artifacts that should be explicitly on the classpath
  • Type: java.util.List
  • Required: No

<compress>

Here you can define the compression of the resources being used. The command line equivalent is: -c, --compress=level>. The valid values for the level are: 0, 1, 2.
  • Type: java.lang.Integer
  • Required: No

<disablePlugin>

You can disable a plugin by using this option. --disable-plugin pluginName.
  • Type: java.lang.String
  • Required: No

<endian>

The byte order of the generated Java Run Time image. --endian <little|big>. If the endian is not given the default is: native.
  • Type: java.lang.String
  • Required: No

<excludedArtifacts>

Artifacts that should be excluded
  • Type: java.util.List
  • Required: No

<generateUpdate4jConfig>

Set if to generate an update4j config file
  • Type: boolean
  • Required: No
  • Default: true

<ignoreAutomaticModules>

Flag to ignore automatic modules.
  • Type: boolean
  • Required: No
  • Default: true

<ignoreSigningInformation>

--ignore-signing-information
  • Type: boolean
  • Required: No
  • Default: false

<jPacktoolMoveAutomaticModules>

Flag if to move real modules from jpacktool-prepare goal
  • Type: boolean
  • Required: No
  • Default: true

<jPacktoolMoveClassPathJars>

Flag if to move classpath jars from jpacktool-prepare goal
  • Type: boolean
  • Required: No
  • Default: true

<jPacktoolMoveRealModules>

Flag if to move real modules from jpacktool-prepare goal. This can not be set to true when using jpackager because jpackager explicitly disallows modules in input directories.
  • Type: boolean
  • Required: No
  • Default: false

<jdkToolchain>

Specify the requirements for this jdk toolchain. This overrules the toolchain selected by the maven-toolchain-plugin.

note: requires at least Maven 3.3.1
  • Type: java.util.Map
  • Required: No

<jpacktoolProperties>

The jpacktool.properties file
  • Type: java.io.File
  • Required: No

<jvmArgs>

JVM flags and options to pass to the application.

--jvm-args <args>

  • Type: java.util.List
  • Required: No

<launcher>

Should the plugin generate a launcher script by means of jlink? The command line equivalent is: --launcher <name>=<module>[/<mainclass>]. The valid values for the level are: <name>=<module>[/<mainclass>].
  • Type: java.lang.String
  • Required: No

<launcherTemplate>

Should the plugin generate a launcher script by means of its own template mechanism.

Can contain either the value "default" or a resource: URL or a path to a file.

The Freemarker Java Template Engine is used for the template.

  • Type: java.lang.String
  • Required: No
  • Default: default

<launcherTemplateScript>

Name of the script generated from launcherTemplate
  • Type: java.lang.String
  • Required: No

<launcherTemplateScriptLinux>

Name of the script generated from launcherTemplate for linux
  • Type: java.lang.String
  • Required: No
  • Default: start.sh

<launcherTemplateScriptMac>

Name of the script generated from launcherTemplate for mac
  • Type: java.lang.String
  • Required: No
  • Default: start.sh

<launcherTemplateScriptWindows>

Name of the script generated from launcherTemplate for windows
  • Type: java.lang.String
  • Required: No
  • Default: start.ps1

<limitModules>

Limit the universe of observable modules. The following gives an example of the configuration which can be used in the pom.xml file.
  <limitModules>
    <limitModule>mod1</limitModule>
    <limitModule>xyz</limitModule>
    .
    .
  </limitModules>

This configuration is the equivalent of the command line option: --limit-modules <mod>[,<mod>...]

  • Type: java.util.List
  • Required: No

<mainClass>

main class for script Generation
  • Type: java.lang.String
  • Required: No

<mainJar>

main jar for script Generation
  • Type: java.lang.String
  • Required: No

<mainModule>

main module for script Generation
  • Type: java.lang.String
  • Required: No

<modulePaths>

Include additional paths on the --module-path option. Project dependencies and JDK modules are automatically added.
  • Type: java.util.List
  • Required: No

<modulesFolderName>

Name of the modules folder
  • Type: java.lang.String
  • Required: No
  • Default: jmods

<noHeaderFiles>

This will suppress to have an includes directory in the resulting Java Run Time Image. The JLink command line equivalent is: --no-header-files
  • Type: boolean
  • Required: No
  • Default: false

<noManPages>

This will suppress to have the man directory in the resulting Java Run Time Image. The JLink command line equivalent is: --no-man-pages
  • Type: boolean
  • Required: No
  • Default: false

<packagingResources>

Resources to package into the image or installable package.

You can use almost any configuration option that the Apache Maven Resources Plugin has on this setting.

When filtering is set to true on a resource the Freemarker Java Template Engine is being used to filter the contents and some variables set by the packaging process are available to it.

Hava a look at the Template Author's Guide for details on how to write templates.

  • Type: net.agilhard.maven.plugins.jpacktool.base.mojo.PackagingResources
  • Required: No

<pluginModulePath>

Define the plugin module path to be used. There can be defined multiple entries separated by either ; or :. The jlink command line equivalent is: --plugin-module-path <modulepath>
  • Type: java.lang.String
  • Required: No

<skip>

skip plugin execution.
  • Type: boolean
  • Required: No
  • Default: false

<sourceJdkModules>

Set the JDK location to create a Java custom runtime image.
  • Type: java.io.File
  • Required: No

<splashScreenOptions>

Options for the SplashScreen
  • Type: net.agilhard.maven.plugins.jpacktool.extend.mojo.SplashScreenOptions
  • Required: No

<stripConfigName>

replace this with nothing in the name of the config file
  • Type: java.lang.String
  • Required: No
  • Default: -jpacktool

<stripDebug>

This is intended to strip debug information out. The command line equivalent of jlink is: -G, --strip-debug strip debug information.
  • Type: boolean
  • Required: No
  • Default: false

<suggestProviders>

Suggest providers that implement the given service types from the module path.
<suggestProviders>
  <suggestProvider>name-a</suggestProvider>
  <suggestProvider>name-b</suggestProvider>
  .
  .
</suggestProviders>
The jlink command line equivalent: --suggest-providers [<name>,...]
  • Type: java.util.List
  • Required: No

<unfilteredDependencyHandling>

Fall back to using old unfiltered maven dependency handling.
  • Type: boolean
  • Required: No
  • Default: false

<verbose>

This will turn on verbose mode.

The jlink/jpackager command line equivalent is: --verbose

  • Type: boolean
  • Required: No
  • Default: false