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 AbstractJModMojo
The
create goal is intended to create jmod files which can be used for later linking via
maven-jlink-plugin. The jmod files
can not be used as usual dependencies on the classpath only in relationship with maven-jlink-plugin.-
Field Summary
FieldsModifier and TypeFieldDescriptionSpecifies one or more directories containing native commands to be copied.Specifies one or more directories containing configuration files to be copied.private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate boolean--do-not-resolve-by-defaultExclude from the default root set of modulesExclude files matching the pattern list.Define the locations of header files.private Fileprivate static final StringDefine the location of legal notices.Specifies one or more directories containing native libraries to be copied (The given directories are relative to project base directory).private final org.codehaus.plexus.languages.java.jpms.LocationManagerprivate StringDefine the main class which is recorded in themodule-info.classfile.Define the locations of man pages.private StringDefine the module version of the jmod file.private Fileprivate StringThis is only the name of the jmod file in the target directory.private Fileprivate String--target-platform <target-platform>Target platform TODO: Which values are valid?private StringHint for a tool to issue a warning if the module is resolved.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsConstructorDescriptionJModCreateMojo(org.apache.maven.toolchain.ToolchainManager toolchainManager, org.codehaus.plexus.languages.java.jpms.LocationManager locationManager) -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.maven.shared.utils.cli.CommandlinecreateJModCreateCommandLine(File resultingJModFile) private voiddeleteOutputIfAlreadyExists(File resultingJModFile) private booleandoDefaultsExist(String defaultLocation) voidexecute()private voidgetCompileClasspathElements(org.apache.maven.project.MavenProject project) private StringgetPlatformSeparatedList(Collection<String> paths) handleConfigurationListWithDefault(List<String> configuration, String defaultLocation) private booleanisConfigurationDefinedInPOM(List<String> configuration) private voidresolveAgainstProjectBaseDir(List<String> relativeDirectories) private voidthrowExceptionIfNotExistOrNotADirectory(List<String> configurations, String partialMessage) private voidwriteBoxedWarning(String message) Methods inherited from class AbstractJModMojo
executeCommand, getCommaSeparatedList, getJModExecutable, getProject, getSession, getToolchain, projectHasAlreadySetAnArtifactMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
JMODS
- See Also:
-
classpathElements
-
modulepathElements
-
compilePath
-
locationManager
private final org.codehaus.plexus.languages.java.jpms.LocationManager locationManager -
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
- See Also:
-
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
- See Also:
-
excludes
-
mainClass
Define the main class which is recorded in themodule-info.classfile. -
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 invalid input: '<'invalid input: '<'pom.xml>> file the locationsrc/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
- See Also:
-
moduleVersion
Define 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
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
- See Also:
-
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
- See Also:
-
outputFileName
@Parameter(defaultValue="${project.artifactId}", required=true, readonly=true) private String outputFileNameThis is only the name of the jmod file in the target directory. -
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
- See Also:
-
targetPlatform
--target-platform <target-platform>Target platform TODO: Which values are valid? -
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 File targetClassesDirectory -
outputDirectory
@Parameter(defaultValue="${project.build.directory}", required=true, readonly=true) private File outputDirectory -
javaHome
-
-
Constructor Details
-
JModCreateMojo
@Inject public JModCreateMojo(org.apache.maven.toolchain.ToolchainManager toolchainManager, org.codehaus.plexus.languages.java.jpms.LocationManager locationManager)
-
-
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
-
deleteOutputIfAlreadyExists
private void deleteOutputIfAlreadyExists(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
-
getCompileClasspathElements
-
preparePaths
private void preparePaths() -
createJModCreateCommandLine
private org.apache.maven.shared.utils.cli.Commandline createJModCreateCommandLine(File resultingJModFile) -
isConfigurationDefinedInPOM
-
handleConfigurationListWithDefault
-
resolveAgainstProjectBaseDir
-
doDefaultsExist
-
getPlatformSeparatedList
-
writeBoxedWarning
-