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=COMPILE, defaultPhase=PACKAGE, requiresProject=true) public class JModCreateMojo extends AbstractJModMojo
Thecreate
goal is intended to createjmod
files which can be used for later linking via maven-jlink-plugin. Thejmod
files 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>
classpathElements
private java.util.List<java.lang.String>
cmds
Specifies one or more directories containing native commands to be copied.private java.util.List<java.lang.String>
compilePath
private java.util.List<java.lang.String>
configs
Specifies one or more directories containing configuration files to be copied.private static java.lang.String
DEFAULT_CMD_DIRECTORY
private static java.lang.String
DEFAULT_CONFIG_DIRECTORY
private static java.lang.String
DEFAULT_HEADER_FILES_DIRECTORY
private static java.lang.String
DEFAULT_LEGAL_NOTICES_DIRECTORY
private static java.lang.String
DEFAULT_LIB_DIRECTORY
private static java.lang.String
DEFAULT_MAN_PAGES_DIRECTORY
private boolean
doNotResolveByDefault
--do-not-resolve-by-default
Exclude from the default root set of modulesprivate java.util.List<java.lang.String>
excludes
Exclude files matching the pattern list.private java.util.List<java.lang.String>
headerFiles
Define the locations of header files.private static java.lang.String
JMODS
private java.util.List<java.lang.String>
legalNotices
Define the location of legal notices.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).private org.codehaus.plexus.languages.java.jpms.LocationManager
locationManager
private java.lang.String
mainClass
Define the main class which is recorded in themodule-info.class
file.private java.util.List<java.lang.String>
manPages
Define the locations of man pages.private java.util.List<java.lang.String>
modulepathElements
private java.util.List<java.lang.String>
modulePaths
private java.lang.String
moduleVersion
Define the module version of the jmod file.private java.io.File
outputDirectory
private java.lang.String
outputFileName
This is only the name of the jmod file in the target directory.private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor>
pathElements
private java.io.File
targetClassesDirectory
private java.lang.String
targetPlatform
--target-platform <target-platform>
Target platform TODO: Which values are valid?private java.lang.String
warnIfResolved
Hint for a tool to issue a warning if the module is resolved.
-
Constructor Summary
Constructors Constructor Description JModCreateMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.codehaus.plexus.util.cli.Commandline
createJModCreateCommandLine(java.io.File resultingJModFile)
private void
deleteOutputIfAlreadyExists(java.io.File resultingJModFile)
private boolean
doDefaultsExist(java.lang.String defaultLocation)
void
execute()
private void
failIfParametersAreNotInTheirValidValueRanges()
private java.util.List<java.io.File>
getCompileClasspathElements(org.apache.maven.project.MavenProject project)
private java.lang.String
getPlatformSeparatedList(java.util.List<java.lang.String> paths)
private java.util.List<java.lang.String>
handleConfigurationListWithDefault(java.util.List<java.lang.String> configuration, java.lang.String defaultLocation)
private boolean
isConfigurationDefinedInPOM(java.util.List<java.lang.String> configuration)
private void
preparePaths()
private java.util.List<java.lang.String>
resolveAgainstProjectBaseDir(java.util.List<java.lang.String> relativeDirectories)
private void
throwExceptionIfNotExistOrNotADirectory(java.util.List<java.lang.String> configurations, java.lang.String partialMessage)
private void
writeBoxedWarning(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
-
pathElements
private java.util.Map<java.lang.String,org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor> pathElements
-
compilePath
@Parameter(defaultValue="${project.compileClasspathElements}", readonly=true, required=true) private java.util.List<java.lang.String> compilePath
-
locationManager
@Component private 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/cmds
used.<cmds> <cmd>...</cmd> <cmd>...</cmd> . . </cmds>
All files from those directories will be copied into the resulting directory
bin
within the jmod file.JMod
command 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/configs
location 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:config
within 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.class
file.
-
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/libs
will 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
lib
within 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 moduleVersion
Define the module version of the jmod file.
-
doNotResolveByDefault
@Parameter(defaultValue="false") private boolean doNotResolveByDefault
--do-not-resolve-by-default
Exclude 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 equivalentincludes
within 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 equivalentman
within 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 outputFileName
This 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 equivalentlegal
within 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
-
modulePaths
private java.util.List<java.lang.String> modulePaths
-
-
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
-
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.codehaus.plexus.util.cli.Commandline createJModCreateCommandLine(java.io.File resultingJModFile) throws java.io.IOException
- Throws:
java.io.IOException
-
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.List<java.lang.String> paths)
-
writeBoxedWarning
private void writeBoxedWarning(java.lang.String message)
-
-