Class JLinkMojo

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

@Mojo(name="jlink",
      requiresDependencyResolution=RUNTIME,
      defaultPhase=PACKAGE,
      requiresProject=true)
public class JLinkMojo
extends AbstractPackageToolMojo
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.
Author:
Karl Heinz Marbaise khmarbaise@apache.org, Bernd Eilers
  • Field Details

    • stripDebug

      @Parameter(defaultValue="false") protected boolean stripDebug
      This is intended to strip debug information out. The command line equivalent of jlink is: -G, --strip-debug strip debug information.
    • compress

      @Parameter protected java.lang.Integer 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.
    • launcher

      @Parameter protected java.lang.String 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>].
    • launcherTemplateScript

      @Parameter protected java.lang.String launcherTemplateScript
      Name of the script generated from launcherTemplate
    • mainClass

      @Parameter protected java.lang.String mainClass
      main class for script Generation
    • mainModule

      @Parameter protected java.lang.String mainModule
      main module for script Generation
    • mainJar

      @Parameter protected java.lang.String mainJar
      main jar for script Generation
    • launcherTemplateScriptWindows

      @Parameter(defaultValue="start.ps1") protected java.lang.String launcherTemplateScriptWindows
      Name of the script generated from launcherTemplate for windows
    • launcherTemplateScriptMac

      @Parameter(defaultValue="start.sh") protected java.lang.String launcherTemplateScriptMac
      Name of the script generated from launcherTemplate for mac
    • launcherTemplateScriptLinux

      @Parameter(defaultValue="start.sh") protected java.lang.String launcherTemplateScriptLinux
      Name of the script generated from launcherTemplate for linux
    • launcherTemplate

      @Parameter(defaultValue="default") protected java.lang.String 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.

    • pluginModulePath

      @Parameter protected java.lang.String 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>
    • outputDirectoryImage

      @Parameter(defaultValue="${project.build.directory}/jlink", required=true, readonly=true) protected java.io.File outputDirectoryImage
      The output directory for the resulting Run Time Image. The created Run Time Image is stored in non compressed form. This will later being packaged into a zip file. --output <path>
    • endian

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

      @Parameter(defaultValue="false") protected boolean bindServices
      Add the option --bind-services or not.
    • disablePlugin

      @Parameter protected java.lang.String disablePlugin
      You can disable a plugin by using this option. --disable-plugin pluginName.
    • ignoreSigningInformation

      @Parameter(defaultValue="false") protected boolean ignoreSigningInformation
      --ignore-signing-information
    • noHeaderFiles

      @Parameter(defaultValue="false") protected boolean 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
    • noManPages

      @Parameter(defaultValue="false") protected boolean 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
    • appFolderName

      @Parameter(defaultValue="app") protected java.lang.String appFolderName
      Name of the "app" folder.
    • lastException

      protected java.lang.Exception lastException
    • suggestProviders

      @Parameter protected java.util.List<java.lang.String> 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>,...]
  • Constructor Details

  • Method Details

    • getJLinkExecutable

      protected java.lang.String getJLinkExecutable() throws java.io.IOException
      Throws:
      java.io.IOException
    • 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
    • updateModel

      protected void updateModel() throws org.apache.maven.plugin.MojoFailureException
      Overrides:
      updateModel in class AbstractPackageToolMojo
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • moveJarToJLinkOutClasspath

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

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

      protected void moveJarToJLinkOutModule​(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
    • getExecutable

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

      protected void failIfParametersAreNotInTheirValidValueRanges() throws org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoFailureException
    • ifOutputDirectoryExistsDeleteIt

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

      protected org.codehaus.plexus.util.cli.Commandline createJLinkCommandLine​(java.util.Collection<java.lang.String> pathsOfModules, java.util.Collection<java.lang.String> modulesToAdd) throws java.io.IOException
      Throws:
      java.io.IOException
    • hasSuggestProviders

      protected boolean hasSuggestProviders()
    • initTemplates

      protected void initTemplates() throws org.apache.maven.plugin.MojoFailureException
      Description copied from class: AbstractTemplateToolMojo
      Initialize Templates copy them from resource: URLs to the filesystem.

      Can be implemented in derived classes the base class method does nothing.

      Overrides:
      initTemplates in class AbstractTemplateToolMojo
      Throws:
      org.apache.maven.plugin.MojoFailureException - on plugin failure
    • generateScript

      public void generateScript() 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
    • executeResources

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

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