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.StringappFolderNameName of the "app" folder.protected booleanbindServicesAdd the option--bind-servicesor not.protected java.lang.IntegercompressHere you can define the compression of the resources being used.protected java.lang.StringdisablePluginYou can disable a plugin by using this option.protected java.lang.StringendianThe byte order of the generated Java Run Time image.protected booleanignoreSigningInformation--ignore-signing-informationprotected java.lang.ExceptionlastExceptionprotected java.lang.StringlauncherShould the plugin generate a launcher script by means of jlink? The command line equivalent is:--launcher <name>=<module>[/<mainclass>].protected java.lang.StringlauncherTemplateShould the plugin generate a launcher script by means of its own template mechanism.protected java.lang.StringlauncherTemplateScriptName of the script generated from launcherTemplateprotected java.lang.StringlauncherTemplateScriptLinuxName of the script generated from launcherTemplate for linuxprotected java.lang.StringlauncherTemplateScriptMacName of the script generated from launcherTemplate for macprotected java.lang.StringlauncherTemplateScriptWindowsName of the script generated from launcherTemplate for windowsprotected java.lang.StringmainClassmain class for script Generationprotected java.lang.StringmainJarmain jar for script Generationprotected java.lang.StringmainModulemain module for script Generationprotected booleannoHeaderFilesThis will suppress to have anincludesdirectory in the resulting Java Run Time Image.protected booleannoManPagesThis will suppress to have themandirectory in the resulting Java Run Time Image.protected java.io.FileoutputDirectoryImageThe output directory for the resulting Run Time Image.protected java.lang.StringpluginModulePathDefine the plugin module path to be used.protected booleanstripDebugThis is intended to strip debug information out.protected java.util.List<java.lang.String>suggestProvidersSuggest 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, unfilteredDependencyHandlingFields inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
outputDirectoyTemplates, templateGeneratorFields 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 voidcheckShouldSkip()protected org.codehaus.plexus.util.cli.CommandlinecreateJLinkCommandLine(java.util.Collection<java.lang.String> pathsOfModules, java.util.Collection<java.lang.String> modulesToAdd)protected voidexecuteResources()voidexecuteToolMain()protected voidfailIfParametersAreNotInTheirValidValueRanges()protected voidgenerateContent()voidgenerateScript()protected java.lang.StringgetExecutable()protected java.lang.StringgetJLinkExecutable()protected booleanhasSuggestProviders()protected voidifOutputDirectoryExistsDeleteIt()protected voidinitTemplates()Initialize Templates copy them from resource: URLs to the filesystem.protected voidmoveJarToJLinkOutAutomatic(java.nio.file.Path source)protected voidmoveJarToJLinkOutClasspath(java.nio.file.Path source)protected voidmoveJarToJLinkOutModule(java.nio.file.Path source)protected voidmoveJPacktoolJars()protected voidupdateJvmArgs()protected voidupdateModel()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, updateJvmArgsMethods inherited from class net.agilhard.maven.plugins.jpacktool.base.mojo.AbstractTemplateToolMojo
generateFromTemplate, getTemplateGenerator, getTemplateMap, initTemplate, loadResourceFileIntoStringMethods 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 ofjlinkis:-G, --strip-debugstrip 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 azipfile.--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-servicesor 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 anincludesdirectory 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 themandirectory 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:
checkShouldSkipin classAbstractToolMojo
-
executeToolMain
public void executeToolMain() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
executeToolMainin classAbstractToolMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
updateModel
protected void updateModel() throws org.apache.maven.plugin.MojoFailureException- Overrides:
updateModelin 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:AbstractTemplateToolMojoInitialize Templates copy them from resource: URLs to the filesystem.Can be implemented in derived classes the base class method does nothing.
- Overrides:
initTemplatesin 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:
updateJvmArgsin classAbstractPackageToolMojo- Throws:
org.apache.maven.plugin.MojoFailureException
-
executeResources
protected void executeResources() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
executeResourcesin classAbstractPackageToolMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
generateContent
protected void generateContent() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
generateContentin classAbstractPackageToolMojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-