Package org.apache.maven.plugins.jmod
Class JModCreateMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.jmod.AbstractJModMojo
-
- org.apache.maven.plugins.jmod.JModCreateMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="create", requiresDependencyResolution=RUNTIME, defaultPhase=PACKAGE, requiresProject=true) public class JModCreateMojo extends AbstractJModMojoThecreategoal is intended to createjmodfiles which can be used for later linking via maven-jlink-plugin. Thejmodfiles can not be used as usual dependencies on the classpath only in relationship withmaven-jlink-plugin.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>classpathElementsprivate java.util.List<java.lang.String>cmdsSpecifies one or more directories containing native commands to be copied.private java.util.List<java.lang.String>compilePathprivate java.util.List<java.lang.String>configsSpecifies one or more directories containing configuration files to be copied.private static java.lang.StringDEFAULT_CMD_DIRECTORYprivate static java.lang.StringDEFAULT_CONFIG_DIRECTORYprivate static java.lang.StringDEFAULT_HEADER_FILES_DIRECTORYprivate static java.lang.StringDEFAULT_LEGAL_NOTICES_DIRECTORYprivate static java.lang.StringDEFAULT_LIB_DIRECTORYprivate static java.lang.StringDEFAULT_MAN_PAGES_DIRECTORYprivate booleandoNotResolveByDefault--do-not-resolve-by-defaultExclude from the default root set of modulesprivate java.util.List<java.lang.String>excludesExclude files matching the pattern list.private java.util.List<java.lang.String>headerFilesDefine the locations of header files.private java.io.FilejavaHomeprivate static java.lang.StringJMODSprivate java.util.List<java.lang.String>legalNoticesDefine the location of legal notices.private java.util.List<java.lang.String>libsSpecifies one or more directories containing native libraries to be copied (The given directories are relative to project base directory).private org.codehaus.plexus.languages.java.jpms.LocationManagerlocationManagerprivate java.lang.StringmainClassDefine the main class which is recorded in themodule-info.classfile.private java.util.List<java.lang.String>manPagesDefine the locations of man pages.private java.util.List<java.lang.String>modulepathElementsprivate java.lang.StringmoduleVersionDefine the module version of the jmod file.private java.io.FileoutputDirectoryprivate java.lang.StringoutputFileNameThis is only the name of the jmod file in the target directory.private java.io.FiletargetClassesDirectoryprivate java.lang.StringtargetPlatform--target-platform <target-platform>Target platform TODO: Which values are valid?private java.lang.StringwarnIfResolvedHint for a tool to issue a warning if the module is resolved.
-
Constructor Summary
Constructors Constructor Description JModCreateMojo(org.apache.maven.toolchain.ToolchainManager toolchainManager, org.codehaus.plexus.languages.java.jpms.LocationManager locationManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.apache.maven.shared.utils.cli.CommandlinecreateJModCreateCommandLine(java.io.File resultingJModFile)private voiddeleteOutputIfAlreadyExists(java.io.File resultingJModFile)private booleandoDefaultsExist(java.lang.String defaultLocation)voidexecute()private voidfailIfParametersAreNotInTheirValidValueRanges()private java.util.List<java.io.File>getCompileClasspathElements(org.apache.maven.project.MavenProject project)private java.lang.StringgetPlatformSeparatedList(java.util.Collection<java.lang.String> paths)private java.util.List<java.lang.String>handleConfigurationListWithDefault(java.util.List<java.lang.String> configuration, java.lang.String defaultLocation)private booleanisConfigurationDefinedInPOM(java.util.List<java.lang.String> configuration)private voidpreparePaths()private java.util.List<java.lang.String>resolveAgainstProjectBaseDir(java.util.List<java.lang.String> relativeDirectories)private voidthrowExceptionIfNotExistOrNotADirectory(java.util.List<java.lang.String> configurations, java.lang.String partialMessage)private voidwriteBoxedWarning(java.lang.String message)-
Methods inherited from class org.apache.maven.plugins.jmod.AbstractJModMojo
executeCommand, getCommaSeparatedList, getJModExecutable, getProject, getSession, getToolchain, projectHasAlreadySetAnArtifact
-
-
-
-
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
-
compilePath
@Parameter(defaultValue="${project.compileClasspathElements}", readonly=true, required=true) private java.util.List<java.lang.String> compilePath
-
locationManager
private final org.codehaus.plexus.languages.java.jpms.LocationManager locationManager
-
cmds
@Parameter private java.util.List<java.lang.String> cmds
Specifies one or more directories containing native commands to be copied. The given directories are relative to the current base directory. If no entry is defined the default issrc/main/cmdsused.<cmds> <cmd>...</cmd> <cmd>...</cmd> . . </cmds>
All files from those directories will be copied into the resulting directory
binwithin the jmod file.JModcommand line equivalent:--cmds <path>.
-
DEFAULT_CMD_DIRECTORY
private static final java.lang.String DEFAULT_CMD_DIRECTORY
- See Also:
- Constant Field Values
-
configs
@Parameter private java.util.List<java.lang.String> configs
Specifies one or more directories containing configuration files to be copied. Location of user-editable config files. If no configuration is given thesrc/main/configslocation is used as default. If this directory does not exist the whole will be ignored.<configs> <config>...</config> <config>...</config> . . </configs>
All files from those directories will be copied into the resulting directory
jmod command line equivalent:configwithin the jmod file.--config <path>.
-
DEFAULT_CONFIG_DIRECTORY
private static final java.lang.String DEFAULT_CONFIG_DIRECTORY
- See Also:
- Constant Field Values
-
excludes
@Parameter private java.util.List<java.lang.String> excludes
Exclude files matching the pattern list. Each element using one the following forms: <glob-pattern>, glob:<glob-pattern> or regex:<regex-pattern><excludes> <exclude>...</exclude> <exclude>...</exclude> . . </excludes>
-
mainClass
@Parameter private java.lang.String mainClass
Define the main class which is recorded in themodule-info.classfile.
-
libs
@Parameter private java.util.List<java.lang.String> libs
Specifies one or more directories containing native libraries to be copied (The given directories are relative to project base directory). If no configuration is given in <> file the location src/main/libswill be used. If the default location does not exist the whole configuration will be ignored.<libs> <lib>...</lib> <lib>...</lib> . . </libs>
All files from those directories will be copied into the resulting directory
libwithin the jmod file.
-
DEFAULT_LIB_DIRECTORY
private static final java.lang.String DEFAULT_LIB_DIRECTORY
- See Also:
- Constant Field Values
-
moduleVersion
@Parameter(defaultValue="${project.version}") private java.lang.String moduleVersionDefine the module version of the jmod file.
-
doNotResolveByDefault
@Parameter(defaultValue="false") private boolean doNotResolveByDefault
--do-not-resolve-by-defaultExclude from the default root set of modules
-
headerFiles
@Parameter private java.util.List<java.lang.String> headerFiles
Define the locations of header files. The default location issrc/main/headerfiles. If the the default location does not exist in the current project it will be ignored. The given directories are relative to the project base directory. If an entry is defined the definition of all locations is needed.<headerFiles> <headerFile>...</headerFile> <headerFile>...</headerFile> . . </headerFiles>
All files from those directories will be copied into the resulting directory
jmod command line equivalentincludeswithin the jmod file.--header-files <path>
-
DEFAULT_HEADER_FILES_DIRECTORY
private static final java.lang.String DEFAULT_HEADER_FILES_DIRECTORY
- See Also:
- Constant Field Values
-
manPages
@Parameter private java.util.List<java.lang.String> manPages
Define the locations of man pages. The default location issrc/main/manpages. The given man pages locations are relative to the project base directory.<manPages> <manPage>...</manPage> <manPage>...</manPage> . . </manPages>
All files from those directories will be copied into the resulting directory
jmod command line equivalentmanwithin the jmod file.--man-pages <path>
-
DEFAULT_MAN_PAGES_DIRECTORY
private static final java.lang.String DEFAULT_MAN_PAGES_DIRECTORY
- See Also:
- Constant Field Values
-
outputFileName
@Parameter(defaultValue="${project.artifactId}", required=true, readonly=true) private java.lang.String outputFileNameThis is only the name of the jmod file in the target directory.
-
legalNotices
@Parameter private java.util.List<java.lang.String> legalNotices
Define the location of legal notices. The default location issrc/main/legalnotices. The given man pages locations are relative to the project base directory.<legalNotices> <legalNotice>...</legalNotice> <legalNotice>...</legalNotice> . . </legalNotices>
All files from those directories will be copied into the resulting directory
jmod command line equivalentlegalwithin the jmod file.--legal-notices <path>
-
DEFAULT_LEGAL_NOTICES_DIRECTORY
private static final java.lang.String DEFAULT_LEGAL_NOTICES_DIRECTORY
- See Also:
- Constant Field Values
-
targetPlatform
@Parameter private java.lang.String targetPlatform
--target-platform <target-platform>Target platform TODO: Which values are valid?
-
warnIfResolved
@Parameter private java.lang.String warnIfResolved
Hint for a tool to issue a warning if the module is resolved. The valid values are:- deprecated
- deprecated-for-removal
- incubating
-
targetClassesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", required=true, readonly=true) private java.io.File targetClassesDirectory
-
outputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private java.io.File outputDirectory
-
javaHome
private java.io.File javaHome
-
-
Method Detail
-
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
-
deleteOutputIfAlreadyExists
private void deleteOutputIfAlreadyExists(java.io.File resultingJModFile) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
failIfParametersAreNotInTheirValidValueRanges
private void failIfParametersAreNotInTheirValidValueRanges() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
throwExceptionIfNotExistOrNotADirectory
private void throwExceptionIfNotExistOrNotADirectory(java.util.List<java.lang.String> configurations, java.lang.String partialMessage) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getCompileClasspathElements
private java.util.List<java.io.File> getCompileClasspathElements(org.apache.maven.project.MavenProject project)
-
preparePaths
private void preparePaths()
-
createJModCreateCommandLine
private org.apache.maven.shared.utils.cli.Commandline createJModCreateCommandLine(java.io.File resultingJModFile)
-
isConfigurationDefinedInPOM
private boolean isConfigurationDefinedInPOM(java.util.List<java.lang.String> configuration)
-
handleConfigurationListWithDefault
private java.util.List<java.lang.String> handleConfigurationListWithDefault(java.util.List<java.lang.String> configuration, java.lang.String defaultLocation)
-
resolveAgainstProjectBaseDir
private java.util.List<java.lang.String> resolveAgainstProjectBaseDir(java.util.List<java.lang.String> relativeDirectories)
-
doDefaultsExist
private boolean doDefaultsExist(java.lang.String defaultLocation)
-
getPlatformSeparatedList
private java.lang.String getPlatformSeparatedList(java.util.Collection<java.lang.String> paths)
-
writeBoxedWarning
private void writeBoxedWarning(java.lang.String message)
-
-