Class JPackagerMojo

All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

@Mojo(name="jpackager",
      requiresDependencyResolution=RUNTIME,
      defaultPhase=PACKAGE,
      requiresProject=true)
public class JPackagerMojo
extends AbstractPackageToolMojo
The JPackager goal is intended to create a native installer package file based on http://openjdk.java.net/jeps/343.
Author:
Bernd Eilers
  • Field Details

    • packageType

      @Parameter(property="jlink-jpackager.package-type", required=false, readonly=false) protected java.lang.String packageType
      Installer type of JPackager operation.

      Valid values for <type> are "msi", "rpm", "deb", "dmg", "pkg", "pkg-app-store".

      If <type> is omitted a value from the platform specific settings <linuxType>, <windowsType> or <macType> is being used.

    • outputDirectoryPackage

      @Parameter(defaultValue="${project.build.directory}/jpackager-out", required=true, readonly=true) protected java.io.File outputDirectoryPackage
      The output directory for the resulting Application Image or Package.

      --output <path>

    • inputDirectoryPackage

      @Parameter(defaultValue="${project.build.directory}/jpackager-in", required=true, readonly=true) protected java.io.File inputDirectoryPackage
      The output directory for the resulting Application Image or Package.

      --output <path>

    • buildRootPackage

      @Parameter(defaultValue="${project.build.directory}/jpackager-build", required=true, readonly=false) protected java.io.File buildRootPackage
      Directory in which to use and place temporary files.

      --build-root <path>

    • moduleTempDirectory

      @Parameter(defaultValue="${project.build.directory}/jpackager-jmods", required=true, readonly=false) protected java.io.File moduleTempDirectory
      TempDirectory where artifact modules are temporarily copied too.
    • copyArtifacts

      @Parameter(defaultValue="true", required=true, readonly=false) protected boolean copyArtifacts
      Flag whether to copy artifact modules to the moduleTempDirectory.

      The default value is true. Setting this to false only works if there are no modules with classes in the module hierachy.

    • files

      @Parameter(required=false, readonly=false) protected java.util.List<java.lang.String> files
      List of files in the base directory. If omitted, all files from "input" directory (which is a mandatory argument in this case) will be packaged.

      --files <files>

    • name

      @Parameter(defaultValue="${project.name}", required=false, readonly=false) protected java.lang.String name
      Name of the application.

      --name <name>

    • mainJar

      @Parameter(required=false, readonly=false) protected java.lang.String mainJar
      The main JAR of the application. This JAR should have the main-class, and is relative to the assembled application directory.

      --main-jar<jarname>

    • mainClass

      @Parameter(required=false, readonly=false) protected java.lang.String mainClass
      Qualified name of the application class to execute.

      -class <className>

    • appVersion

      @Parameter(defaultValue="${project.version}", required=false, readonly=false) protected java.lang.String appVersion
      Version of the application.

      Note a -SNAPSHOT or .SNAPSHOT is automatically deleted from the version when constructing the jpackage command line arguments.

      --app-version <version>

    • icon

      @Parameter(required=false, readonly=false) protected java.io.File icon
      Icon of the application bundle.

      --icon <path>

    • identifier

      @Parameter(defaultValue="${project.groupId}.${project.artifactId}", required=false, readonly=false) protected java.lang.String identifier
      Machine readable identifier of the application. The format must be a DNS name in reverse order, such as com.example.myapplication.

      --identifier <identifier>

    • fileAssociations

      @Parameter(required=false, readonly=false) protected java.io.File fileAssociations
      Properties file that contains list of key=value parameters that describe a file association. "extension", "mime-type", "icon", "description" can be used as keys for the association.

      --file-associations <path>

    • secondaryLauncher

      @Parameter(required=false, readonly=false) protected java.io.File secondaryLauncher
      Properties file that contains a collection of options for a secondary launcher.

      --secondary-launcher <path>

    • runtimeImage

      @Parameter(required=false, readonly=false) protected java.io.File runtimeImage
      Location of the predefined runtime image that is used to build an application image and installable package.

      --runtime-image <path>

    • appImage

      @Parameter(required=false, readonly=false) protected java.io.File appImage
      Location of the predefined application image that is used to build an installable package.

      --app-image <path>

    • installDir

      @Parameter(required=false, readonly=false) protected java.lang.String installDir
      Qualified name of the application class to execute.

      -install-dir <path>

    • licenseFile

      @Parameter(required=false, readonly=false) protected java.lang.String licenseFile
      The license file, relative to the base directory.

      --license-file <path>

    • resourceDir

      @Parameter(required=false, readonly=false) protected java.lang.String resourceDir
      This argument defines the path (absolute or relative) to the resource directory which overrides jpackage resources, including icons, template files or other files.
    • copyright

      @Parameter(required=false, readonly=false) protected java.lang.String copyright
      Copyright for the application.

      --copyright <text>

    • description

      @Parameter(defaultValue="${project.description}", required=false, readonly=false) protected java.lang.String description
      Description of the application.

      --description <text>

    • category

      @Parameter(required=false, readonly=false) protected java.lang.String category
      Category or group of the application

      --category <text>

    • vendor

      @Parameter(defaultValue="${project.organization}", required=false, readonly=false) protected java.lang.String vendor
      Vendor of the application.

      --vendor <text>

    • module

      @Parameter(required=false, readonly=false) protected java.lang.String module
      Main module of the application. This module must have the main-class, and be on the module path.

      --module <name>

    • skipModulesInclude

      @Parameter(defaultValue="false", required=false, readonly=false) protected boolean skipModulesInclude
      Skip including of modules.
    • usingJDK11Jpackager

      protected boolean usingJDK11Jpackager
      Flag to indicate we are use JDK11 ported jpackager from the posting Filling the Packager gap
    • lastException

      protected java.lang.Exception lastException
  • Constructor Details

  • Method Details

    • getJPackageExecutable

      protected java.lang.String getJPackageExecutable() throws java.io.IOException
      Throws:
      java.io.IOException
    • getJPackagerExecutable

      protected java.lang.String getJPackagerExecutable() throws java.io.IOException
      Throws:
      java.io.IOException
    • isUsingJDK11Jpackager

      public boolean isUsingJDK11Jpackager()
    • checkShouldSkip

      public void checkShouldSkip()
      Overrides:
      checkShouldSkip in class AbstractToolMojo
    • executeToolMain

      public void executeToolMain() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Specified by:
      executeToolMain in class AbstractToolMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • moveJarToInputClasspath

      protected void moveJarToInputClasspath​(java.nio.file.Path source) throws java.io.IOException
      Throws:
      java.io.IOException
    • moveJarToInputAutomatic

      protected void moveJarToInputAutomatic​(java.nio.file.Path source) throws java.io.IOException
      Throws:
      java.io.IOException
    • moveJarToInputModule

      protected void moveJarToInputModule​(java.nio.file.Path source) throws java.io.IOException
      Throws:
      java.io.IOException
    • moveJPacktoolJars

      protected void moveJPacktoolJars() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • maySetPlatformDefaultType

      protected void maySetPlatformDefaultType()
    • publishPackageArtifacts

      protected void publishPackageArtifacts()
    • findPackageFile

      protected java.io.File findPackageFile​(java.lang.String extension)
    • copyArtifactsToModuleTempDirectory

      protected void copyArtifactsToModuleTempDirectory() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getExecutable

      protected java.lang.String getExecutable() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • ifBuildRootDirectoryDoesNotExistcreateIt

      protected void ifBuildRootDirectoryDoesNotExistcreateIt() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • ifModuleTempDirectoryDoesNotExistCreateIt

      protected void ifModuleTempDirectoryDoesNotExistCreateIt() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • ifOutputDirectoryExistsDeleteIt

      protected void ifOutputDirectoryExistsDeleteIt() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • createJPackageCommandLine

      protected org.codehaus.plexus.util.cli.Commandline createJPackageCommandLine​(java.util.Collection<java.lang.String> pathsOfModules, java.util.Collection<java.lang.String> modulesToAdd) throws java.io.IOException
      Build Commandline for JDK >= 12 jpackage command
      Parameters:
      pathsOfModules - collected paths of modules
      modulesToAdd - collected modules to add
      Returns:
      a Commandline
      Throws:
      java.io.IOException - on i/o error
    • createJPackagerCommandLine

      protected org.codehaus.plexus.util.cli.Commandline createJPackagerCommandLine​(java.util.Collection<java.lang.String> pathsOfModules, java.util.Collection<java.lang.String> modulesToAdd) throws java.io.IOException
      Build Commandline for JDK11 backported jpackager command
      Parameters:
      pathsOfModules - collected paths of modules
      modulesToAdd - collected modules to add
      Returns:
      a Commandline
      Throws:
      java.io.IOException - on i/o error
    • failIfParametersAreNotValid

      protected void failIfParametersAreNotValid() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • updateJvmArgs

      protected void updateJvmArgs() throws org.apache.maven.plugin.MojoFailureException
      Specified by:
      updateJvmArgs in class AbstractPackageToolMojo
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • generateContent

      protected void generateContent() throws org.apache.maven.plugin.MojoExecutionException
      Specified by:
      generateContent in class AbstractPackageToolMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • executeResources

      protected void executeResources() throws org.apache.maven.plugin.MojoExecutionException
      Specified by:
      executeResources in class AbstractPackageToolMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException