Package org.apache.maven.plugins.jlink
Class JLinkMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.jlink.AbstractJLinkMojo
-
- org.apache.maven.plugins.jlink.JLinkMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="jlink", requiresDependencyCollection=RUNTIME, defaultPhase=PACKAGE, requiresProject=true) public class JLinkMojo extends AbstractJLinkMojo
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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
addModules
Usually this is not necessary, cause this is handled automatically by the given dependencies.private boolean
bindServices
Add the option--bind-services
or not.private java.util.List<java.lang.String>
classpathElements
private java.lang.Integer
compression
Here you can define the compression of the resources being used.private java.lang.String
disablePlugin
You can disable a plugin by using this option.private java.lang.String
endian
The byte order of the generated Java Run Time image.private java.lang.String
finalName
Name of the generated ZIP file in thetarget
directory.private boolean
ignoreSigningInformation
--ignore-signing-information
private java.util.Map<java.lang.String,java.lang.String>
jdkToolchain
Specify the requirements for this jdk toolchain.private static java.lang.String
JMODS
private java.util.List<java.lang.String>
limitModules
Limit the universe of observable modules.private org.codehaus.plexus.languages.java.jpms.LocationManager
locationManager
private java.util.List<java.lang.String>
modulepathElements
private java.util.List<java.lang.String>
modulePaths
private boolean
noHeaderFiles
This will suppress to have anincludes
directory in the resulting Java Run Time Image.private boolean
noManPages
This will suppress to have theman
directory in the resulting Java Run Time Image.private java.io.File
outputDirectory
private java.io.File
outputDirectoryImage
The output directory for the resulting Run Time Image.private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor>
pathElements
private java.lang.String
pluginModulePath
Define the plugin module path to be used.private boolean
stripDebug
This is intended to strip debug information out.private java.util.List<java.lang.String>
suggestProviders
Suggest providers that implement the given service types from the module path.private boolean
verbose
This will turn on verbose mode.private org.codehaus.plexus.archiver.zip.ZipArchiver
zipArchiver
The JAR archiver needed for archiving the environments.
-
Constructor Summary
Constructors Constructor Description JLinkMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.codehaus.plexus.util.cli.Commandline
createJLinkCommandLine()
private java.io.File
createZipArchiveFromImage(java.io.File outputDirectory, java.io.File outputDirectoryImage)
void
execute()
private void
failIfParametersAreNotInTheirValidValueRanges()
private java.util.List<java.io.File>
getCompileClasspathElements(org.apache.maven.project.MavenProject project)
private java.lang.String
getExecutable()
private boolean
hasLimitModules()
private boolean
hasModules()
private boolean
hasSuggestProviders()
private void
ifOutputDirectoryExistsDelteIt()
private void
preparePaths()
private boolean
projectHasAlreadySetAnArtifact()
private void
writeBoxedWarning(java.lang.String message)
-
Methods inherited from class org.apache.maven.plugins.jlink.AbstractJLinkMojo
convertSeparatedModulePathToPlatformSeparatedModulePath, executeCommand, getArchiveFile, getCommaSeparatedList, getJLinkExecutable, getPlatformDependSeparateList, getProject, getSession, getToolchain, hasClassifier
-
-
-
-
Field Detail
-
JMODS
private static final java.lang.String JMODS
- See Also:
- Constant Field Values
-
classpathElements
private java.util.List<java.lang.String> classpathElements
-
modulepathElements
private java.util.List<java.lang.String> modulepathElements
-
pathElements
private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> pathElements
-
locationManager
@Component private org.codehaus.plexus.languages.java.jpms.LocationManager locationManager
-
jdkToolchain
@Parameter private java.util.Map<java.lang.String,java.lang.String> 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
-
stripDebug
@Parameter(defaultValue="false") private boolean stripDebug
This is intended to strip debug information out. The command line equivalent ofjlink
is:-G, --strip-debug
strip debug information.
-
compression
@Parameter private java.lang.Integer compression
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
.
-
limitModules
@Parameter private java.util.List<java.lang.String> limitModules
Limit the universe of observable modules. The following gives an example of the configuration which can be used in thepom.xml
file.<limitModules> <limitModule>mod1</limitModule> <limitModule>xyz</limitModule> . . </limitModules>
This configuration is the equivalent of the command line option:--limit-modules <mod>[,<mod>...]
-
addModules
@Parameter private java.util.List<java.lang.String> 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>...]
.
-
pluginModulePath
@Parameter private 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}/maven-jlink", required=true, readonly=true) private 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 azip
file.--output <path>
-
outputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private java.io.File outputDirectory
-
endian
@Parameter private 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
.
-
modulePaths
private java.util.List<java.lang.String> modulePaths
-
bindServices
@Parameter(defaultValue="false") private boolean bindServices
Add the option--bind-services
or not.
-
disablePlugin
@Parameter private java.lang.String disablePlugin
You can disable a plugin by using this option.--disable-plugin pluginName
.
-
ignoreSigningInformation
@Parameter(defaultValue="false") private boolean ignoreSigningInformation
--ignore-signing-information
-
noHeaderFiles
@Parameter(defaultValue="false") private boolean noHeaderFiles
This 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") private boolean noManPages
This will suppress to have theman
directory in the resulting Java Run Time Image. The JLink command line equivalent is:--no-man-pages
-
suggestProviders
@Parameter private 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 linke equivalent:--suggest-providers [<name>,...]
-
verbose
@Parameter(defaultValue="false") private boolean verbose
This will turn on verbose mode. The jlink command line equivalent is:--verbose
-
zipArchiver
@Component(role=org.codehaus.plexus.archiver.Archiver.class, hint="zip") private org.codehaus.plexus.archiver.zip.ZipArchiver zipArchiver
The JAR archiver needed for archiving the environments.
-
finalName
@Parameter(defaultValue="${project.build.finalName}", readonly=true) private java.lang.String finalName
Name of the generated ZIP file in thetarget
directory. This will not change the name of the installed/deployed file.
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getCompileClasspathElements
private java.util.List<java.io.File> getCompileClasspathElements(org.apache.maven.project.MavenProject project)
-
preparePaths
private void preparePaths()
-
getExecutable
private java.lang.String getExecutable() throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
projectHasAlreadySetAnArtifact
private boolean projectHasAlreadySetAnArtifact()
-
createZipArchiveFromImage
private java.io.File createZipArchiveFromImage(java.io.File outputDirectory, java.io.File outputDirectoryImage) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
failIfParametersAreNotInTheirValidValueRanges
private void failIfParametersAreNotInTheirValidValueRanges() throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
ifOutputDirectoryExistsDelteIt
private void ifOutputDirectoryExistsDelteIt() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createJLinkCommandLine
private org.codehaus.plexus.util.cli.Commandline createJLinkCommandLine() throws java.io.IOException
- Throws:
java.io.IOException
-
hasSuggestProviders
private boolean hasSuggestProviders()
-
hasLimitModules
private boolean hasLimitModules()
-
hasModules
private boolean hasModules()
-
writeBoxedWarning
private void writeBoxedWarning(java.lang.String message)
-
-