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
  • Field Details

    • MODULE_INFO_CLASS

      private static final String MODULE_INFO_CLASS
      See Also:
    • VERSIONED_MODULE_INFO

      private static final Pattern 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

      @Parameter(defaultValue="${project.version}", readonly=true, required=true) private String version
    • jvmVersion

      @Parameter(property="moditect.jvmVersion") private String jvmVersion
    • workingDirectory

      @Parameter(readonly=true, defaultValue="${project.build.directory}/moditect") private File workingDirectory
    • buildDirectory

      @Parameter(readonly=true, defaultValue="${project.build.directory}") private File buildDirectory
    • outputDirectory

      @Parameter(property="outputDirectory", defaultValue="${project.build.directory}/modules") private File outputDirectory
    • overwriteExistingFiles

      @Parameter(property="overwriteExistingFiles", defaultValue="false") private boolean overwriteExistingFiles
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}") private String 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

      @Parameter private MainModuleConfiguration module
    • modules

      @Parameter private List<ModuleConfiguration> modules
    • exclusions

      @Parameter private List<org.apache.maven.model.Exclusion> exclusions
    • jdepsExtraArgs

      @Parameter private List<String> 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

      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.
    • 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

      private String getVersion(ModuleConfiguration moduleConfiguration)
    • 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,Path> modularizedJars) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getModuleInfoSource

      private String getModuleInfoSource(Path inputFile, MainModuleConfiguration moduleConfiguration, ModuleInfoGenerator moduleInfoGenerator, Map<ArtifactIdentifier,String> assignedNamesByModule, Map<ArtifactIdentifier,Path> modularizedJars) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getLines

      private String getLines(Path file) throws org.apache.maven.plugin.MojoExecutionException
      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)