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
FieldsModifier and TypeFieldDescriptionUsually this is not necessary, cause this is handled automatically by the given dependencies.private booleanAdd the option--bind-servicesor not.private IntegerHere you can define the compression of the resources being used.private StringYou can disable a plugin by using this option.private StringThe byte order of the generated Java Run Time image.private StringName of the generated ZIP file in thetargetdirectory.private boolean--ignore-signing-informationSpecify the requirements for this jdk toolchain.private static final StringLimit the universe of observable modules.private org.codehaus.plexus.languages.java.jpms.LocationManagerprivate booleanThis will suppress to have anincludesdirectory in the resulting Java Run Time Image.private booleanThis will suppress to have themandirectory in the resulting Java Run Time Image.private Fileprivate FileThe output directory for the resulting Run Time Image.private StringDefine the plugin module path to be used.private booleanThis is intended to strip debug information out.Suggest providers that implement the given service types from the module path.private booleanThis will turn on verbose mode.private org.codehaus.plexus.archiver.zip.ZipArchiverThe JAR archiver needed for archiving the environments.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.codehaus.plexus.util.cli.Commandlineprivate FilecreateZipArchiveFromImage(File outputDirectory, File outputDirectoryImage) voidexecute()private voidgetCompileClasspathElements(org.apache.maven.project.MavenProject project) private Stringprivate booleanprivate booleanprivate booleanprivate voidprivate voidprivate booleanprivate voidwriteBoxedWarning(String message) Methods inherited from class org.apache.maven.plugins.jlink.AbstractJLinkMojo
convertSeparatedModulePathToPlatformSeparatedModulePath, executeCommand, getArchiveFile, getCommaSeparatedList, getJLinkExecutable, getPlatformDependSeparateList, getProject, getSession, getToolchain, hasClassifierMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
JMODS
- See Also:
-
classpathElements
-
modulepathElements
-
pathElements
-
locationManager
@Component private org.codehaus.plexus.languages.java.jpms.LocationManager locationManager -
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 stripDebugThis is intended to strip debug information out. The command line equivalent ofjlinkis:-G, --strip-debugstrip debug information. -
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
Limit the universe of observable modules. The following gives an example of the configuration which can be used in thepom.xmlfile.<limitModules> <limitModule>mod1</limitModule> <limitModule>xyz</limitModule> . . </limitModules>This configuration is the equivalent of the command line option:--limit-modules <mod>[,<mod>...] -
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.xmlfile can look like this:<addModules> <addModule>mod1</addModule> <addModule>first</addModule> . . </addModules>
The command line equivalent for jlink is:--add-modules <mod>[,<mod>...]. -
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 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> -
outputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private File outputDirectory -
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
-
bindServices
@Parameter(defaultValue="false") private boolean bindServicesAdd the option--bind-servicesor not. -
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 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") private boolean noManPagesThis will suppress to have themandirectory in the resulting Java Run Time Image. The JLink command line equivalent is:--no-man-pages -
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 verboseThis 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 zipArchiverThe JAR archiver needed for archiving the environments. -
finalName
Name of the generated ZIP file in thetargetdirectory. This will not change the name of the installed/deployed file.
-
-
Constructor Details
-
JLinkMojo
public JLinkMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getCompileClasspathElements
-
preparePaths
private void preparePaths() -
getExecutable
- Throws:
org.apache.maven.plugin.MojoFailureException
-
projectHasAlreadySetAnArtifact
private boolean projectHasAlreadySetAnArtifact() -
createZipArchiveFromImage
private File createZipArchiveFromImage(File outputDirectory, 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
- Throws:
IOException
-
hasSuggestProviders
private boolean hasSuggestProviders() -
hasLimitModules
private boolean hasLimitModules() -
hasModules
private boolean hasModules() -
writeBoxedWarning
-