Package org.moditect.mavenplugin.add
Class AddModuleInfoMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.moditect.mavenplugin.add.AddModuleInfoMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="add-module-info",
defaultPhase=PROCESS_RESOURCES,
requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
public class AddModuleInfoMojo
extends org.apache.maven.plugin.AbstractMojo
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private File
private List
<org.apache.maven.model.Exclusion> private boolean
private String
private MainModuleConfiguration
private static final String
private List
<ModuleConfiguration> private File
private String
Timestamp for reproducible output archive entries, either formatted as ISO 8601 extended offset date-time (e.g.private boolean
protected org.apache.maven.project.MavenProject
private List
<org.eclipse.aether.repository.RemoteRepository> private org.eclipse.aether.RepositorySystemSession
private org.eclipse.aether.RepositorySystem
private boolean
private String
private static final Pattern
private File
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private String
determineVersion
(ArtifactConfiguration artifact) void
execute()
private String
getAssignedModuleName
(Map<ArtifactIdentifier, String> assignedNamesByModule, org.apache.maven.artifact.Artifact artifact) private Map
<ArtifactIdentifier, String> getAssignedModuleNamesByModule
(ArtifactResolutionHelper artifactResolutionHelper) private Path
getInputFile
(ModuleConfiguration moduleConfiguration, ArtifactResolutionHelper artifactResolutionHelper) private String
private String
getModuleInfoSource
(Path inputFile, MainModuleConfiguration moduleConfiguration, ModuleInfoGenerator moduleInfoGenerator, Map<ArtifactIdentifier, String> assignedNamesByModule, Map<ArtifactIdentifier, Path> modularizedJars) private String
getModuleInfoSource
(Path inputFile, ModuleConfiguration moduleConfiguration, ModuleInfoGenerator moduleInfoGenerator, Map<ArtifactIdentifier, String> assignedNamesByModule, Map<ArtifactIdentifier, Path> modularizedJars) private String
getVersion
(ModuleConfiguration moduleConfiguration) private boolean
isModularJar
(Path jarPath) Determines if the given JAR is already modular that is, it contains either a "module-info.class" entry or at least one "/META-INF/version/\\d+/module-info.class" entry.private void
resolveArtifactsToBeModularized
(ArtifactResolutionHelper artifactResolutionHelper) Sets the resolved artifact of all artifact configurations.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
MODULE_INFO_CLASS
- See Also:
-
VERSIONED_MODULE_INFO
-
repoSystem
@Component private org.eclipse.aether.RepositorySystem repoSystem -
repoSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true, required=true) private org.eclipse.aether.RepositorySystemSession repoSession -
remoteRepos
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true, required=true) private List<org.eclipse.aether.repository.RemoteRepository> remoteRepos -
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project -
artifactId
@Parameter(defaultValue="${project.artifactId}", readonly=true, required=true) private String artifactId -
version
-
jvmVersion
-
workingDirectory
@Parameter(readonly=true, defaultValue="${project.build.directory}/moditect") private File workingDirectory -
buildDirectory
-
outputDirectory
@Parameter(property="outputDirectory", defaultValue="${project.build.directory}/modules") private File outputDirectory -
overwriteExistingFiles
@Parameter(property="overwriteExistingFiles", defaultValue="false") private boolean overwriteExistingFiles -
outputTimestamp
Timestamp for reproducible output archive entries, either formatted as ISO 8601 extended offset date-time (e.g. in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'), or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH). -
skip
@Parameter(property="moditect.skip", defaultValue="false") private boolean skip -
failOnWarning
@Parameter(property="moditect.failOnWarning", defaultValue="true") private boolean failOnWarning -
module
-
modules
-
exclusions
-
jdepsExtraArgs
-
-
Constructor Details
-
AddModuleInfoMojo
public AddModuleInfoMojo()
-
-
Method Details
-
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
-
isModularJar
Determines if the given JAR is already modular that is, it contains either a "module-info.class" entry or at least one "/META-INF/version/\\d+/module-info.class" entry. -
resolveArtifactsToBeModularized
private void resolveArtifactsToBeModularized(ArtifactResolutionHelper artifactResolutionHelper) throws org.apache.maven.plugin.MojoExecutionException Sets the resolved artifact of all artifact configurations. If no version is given, we try to obtain it from the project dependencies.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
determineVersion
private String determineVersion(ArtifactConfiguration artifact) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getVersion
-
getInputFile
private Path getInputFile(ModuleConfiguration moduleConfiguration, ArtifactResolutionHelper artifactResolutionHelper) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getModuleInfoSource
private String getModuleInfoSource(Path inputFile, ModuleConfiguration moduleConfiguration, ModuleInfoGenerator moduleInfoGenerator, Map<ArtifactIdentifier, String> assignedNamesByModule, Map<ArtifactIdentifier, throws org.apache.maven.plugin.MojoExecutionExceptionPath> modularizedJars) - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getModuleInfoSource
private String getModuleInfoSource(Path inputFile, MainModuleConfiguration moduleConfiguration, ModuleInfoGenerator moduleInfoGenerator, Map<ArtifactIdentifier, String> assignedNamesByModule, Map<ArtifactIdentifier, throws org.apache.maven.plugin.MojoExecutionExceptionPath> modularizedJars) - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getLines
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createDirectories
private void createDirectories() -
getAssignedModuleNamesByModule
private Map<ArtifactIdentifier,String> getAssignedModuleNamesByModule(ArtifactResolutionHelper artifactResolutionHelper) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getAssignedModuleName
private String getAssignedModuleName(Map<ArtifactIdentifier, String> assignedNamesByModule, org.apache.maven.artifact.Artifact artifact)
-