Class JLinkMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractPackageToolMojo
net.agilhard.maven.plugins.jpacktool.base.mojo.jlink.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
-
Nested Class Summary
Nested classes/interfaces inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
AbstractTemplateToolMojo.TemplateGenerator
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
appFolderName
Name of the "app" folder.protected boolean
bindServices
Add the option--bind-services
or not.protected java.lang.Integer
compress
Here you can define the compression of the resources being used.protected java.lang.String
disablePlugin
You can disable a plugin by using this option.protected java.lang.String
endian
The byte order of the generated Java Run Time image.protected boolean
ignoreSigningInformation
--ignore-signing-information
protected java.lang.Exception
lastException
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>]
.protected java.lang.String
launcherTemplate
Should the plugin generate a launcher script by means of its own template mechanism.protected java.lang.String
launcherTemplateScript
Name of the script generated from launcherTemplateprotected java.lang.String
launcherTemplateScriptLinux
Name of the script generated from launcherTemplate for linuxprotected java.lang.String
launcherTemplateScriptMac
Name of the script generated from launcherTemplate for macprotected java.lang.String
launcherTemplateScriptWindows
Name of the script generated from launcherTemplate for windowsprotected java.lang.String
mainClass
main class for script Generationprotected java.lang.String
mainJar
main jar for script Generationprotected java.lang.String
mainModule
main module for script Generationprotected boolean
noHeaderFiles
This will suppress to have anincludes
directory in the resulting Java Run Time Image.protected boolean
noManPages
This will suppress to have theman
directory in the resulting Java Run Time Image.protected java.io.File
outputDirectoryImage
The output directory for the resulting Run Time Image.protected java.lang.String
pluginModulePath
Define the plugin module path to be used.protected boolean
stripDebug
This is intended to strip debug information out.protected java.util.List<java.lang.String>
suggestProviders
Suggest providers that implement the given service types from the module path.Fields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractPackageToolMojo
addJDKToLimitModules, addModules, arguments, automaticModulesFolderName, buildContext, classPathFolderName, context, dependencyGraphBuilder, finalName, ignoreAutomaticModules, JMODS, jPacktoolMoveAutomaticModules, jPacktoolMoveClassPathJars, jPacktoolMoveRealModules, jpacktoolPrepareUsed, jvmArgs, limitModules, mavenFileFilter, mavenResourcesFiltering, modulePaths, modulesFolderName, modulesToAdd, outputDirectory, packagingResources, pathsOfArtifacts, pathsOfModules, sourceJdkModules, unfilteredDependencyHandling
Fields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
outputDirectoyTemplates, templateGenerator
Fields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
buildDirectory, classpathArtifacts, excludedArtifacts, javaVersion, jdkToolchain, jpacktoolModel, jpacktoolPropertyPrefix, locationManager, mavenProjectHelper, outputDirectoryAutomaticJars, outputDirectoryClasspathJars, outputDirectoryJPacktool, outputDirectoryModules, project, session, shouldSkipReason, skip, systemModules, templateMap, toolchainManager, verbose, zipArchiver
-
Constructor Summary
Constructors Constructor Description JLinkMojo()
-
Method Summary
Modifier and Type Method Description void
checkShouldSkip()
protected org.codehaus.plexus.util.cli.Commandline
createJLinkCommandLine(java.util.Collection<java.lang.String> pathsOfModules, java.util.Collection<java.lang.String> modulesToAdd)
protected void
executeResources()
void
executeToolMain()
protected void
failIfParametersAreNotInTheirValidValueRanges()
protected void
generateContent()
void
generateScript()
protected java.lang.String
getExecutable()
protected java.lang.String
getJLinkExecutable()
protected boolean
hasSuggestProviders()
protected void
ifOutputDirectoryExistsDeleteIt()
protected void
initTemplates()
Initialize Templates copy them from resource: URLs to the filesystem.protected void
moveJarToJLinkOutAutomatic(java.nio.file.Path source)
protected void
moveJarToJLinkOutClasspath(java.nio.file.Path source)
protected void
moveJarToJLinkOutModule(java.nio.file.Path source)
protected void
moveJPacktoolJars()
protected void
updateJvmArgs()
protected void
updateModel()
Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractPackageToolMojo
addSystemModulesFromJPackToolPrepare, addSystemModulesToLimitModules, addToLimitModules, appendOrCreateJvmArgPath, checkJpacktoolPrepareUsed, contextualize, convertSeparatedModulePathToPlatformSeparatedModulePath, executeResources, failIfProjectHasAlreadySetAnArtifact, generateContent, getAddModules, getArguments, getAutomaticModulesFolderName, getBuildContext, getBuildDirectory, getClassPathFolderName, getCommaSeparatedList, getCompileClasspathElements, getContext, getDependenciesToLink, getFinalName, getJpacktoolModel, getJvmArgs, getLimitModules, getMavenFileFilter, getMavenResourcesFiltering, getModulePathElements, getModulePaths, getModulesFolderName, getModulesToAdd, getOutputDirectory, getOutputDirectoyTemplates, getPackagingResources, getPathSeparatedList, getPathsOfArtifacts, getPathsOfModules, getPlatformDependSeparateList, getZipArchiver, hasLimitModules, initJPacktoolModel, isAddJDKToLimitModules, isIgnoreAutomaticModules, isjPacktoolMoveAutomaticModules, isjPacktoolMoveClassPathJars, isjPacktoolMoveRealModules, isJpacktoolPrepareUsed, prepareModules, prepareModules, projectHasAlreadySetAnArtifact, resolveAndCreate, updateJvmArgs
Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
generateFromTemplate, getTemplateGenerator, getTemplateMap, initTemplate, loadResourceFileIntoString
Methods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractToolMojo
bytesToHex, createZipArchiveFromDirectory, execute, executeCommand, executeToolFinish, executeToolStart, getArtifactFile, getClasspathArtifacts, getExcludedArtifacts, getJavaVersion, getJdkToolchain, getJpacktoolPropertyPrefix, getLocationManager, getOutputDirectoryAutomaticJars, getOutputDirectoryClasspathJars, getOutputDirectoryJPacktool, getOutputDirectoryModules, getPluginVersion, getProject, getSession, getShouldSkipReason, getSystemModules, getToolchain, getToolchainManager, getToolExecutable, hasClassifier, isVerbose, publishJPacktoolProperties, publishSHA256, setShouldSkipReason
-
Field Details
-
stripDebug
@Parameter(defaultValue="false") protected boolean stripDebugThis is intended to strip debug information out. The command line equivalent ofjlink
is:-G, --strip-debug
strip debug information. -
compress
@Parameter protected java.lang.Integer compressHere 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 launcherShould 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 launcherTemplateScriptName of the script generated from launcherTemplate -
mainClass
@Parameter protected java.lang.String mainClassmain class for script Generation -
mainModule
@Parameter protected java.lang.String mainModulemain module for script Generation -
mainJar
@Parameter protected java.lang.String mainJarmain jar for script Generation -
launcherTemplateScriptWindows
@Parameter(defaultValue="start.ps1") protected java.lang.String launcherTemplateScriptWindowsName of the script generated from launcherTemplate for windows -
launcherTemplateScriptMac
@Parameter(defaultValue="start.sh") protected java.lang.String launcherTemplateScriptMacName of the script generated from launcherTemplate for mac -
launcherTemplateScriptLinux
@Parameter(defaultValue="start.sh") protected java.lang.String launcherTemplateScriptLinuxName of the script generated from launcherTemplate for linux -
launcherTemplate
@Parameter(defaultValue="default") protected java.lang.String launcherTemplateShould 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 pluginModulePathDefine 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 outputDirectoryImageThe 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 azip
file.--output <path>
-
endian
@Parameter protected java.lang.String endianThe 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 bindServicesAdd the option--bind-services
or not. -
disablePlugin
@Parameter protected java.lang.String disablePluginYou 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 noHeaderFilesThis will suppress to have anincludes
directory in the resulting Java Run Time Image. The JLink command line equivalent is:--no-header-files
-
noManPages
@Parameter(defaultValue="false") protected boolean noManPagesThis will suppress to have theman
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 appFolderNameName of the "app" folder. -
lastException
protected java.lang.Exception lastException -
suggestProviders
@Parameter protected java.util.List<java.lang.String> suggestProvidersSuggest 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
-
JLinkMojo
public JLinkMojo()
-
-
Method Details
-
getJLinkExecutable
protected java.lang.String getJLinkExecutable() throws java.io.IOException- Throws:
java.io.IOException
-
checkShouldSkip
public void checkShouldSkip()- Overrides:
checkShouldSkip
in classAbstractToolMojo
-
executeToolMain
public void executeToolMain() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
executeToolMain
in classAbstractToolMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
updateModel
protected void updateModel() throws org.apache.maven.plugin.MojoFailureException- Overrides:
updateModel
in classAbstractPackageToolMojo
- 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.MojoFailureExceptionDescription 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 classAbstractTemplateToolMojo
- 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 classAbstractPackageToolMojo
- Throws:
org.apache.maven.plugin.MojoFailureException
-
executeResources
protected void executeResources() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
executeResources
in classAbstractPackageToolMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generateContent
protected void generateContent() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
generateContent
in classAbstractPackageToolMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
-