Class ReactorReader

java.lang.Object
org.apache.maven.ReactorReader
All Implemented Interfaces:
MavenWorkspaceReader, org.eclipse.aether.repository.WorkspaceReader

@Named("reactor") class ReactorReader extends Object implements MavenWorkspaceReader
An implementation of a workspace reader that knows how to search the Maven reactor for artifacts, either as packaged jar if it has been built, or only compile output directory if packaging hasn't happened yet.
  • Field Details

  • Constructor Details

    • ReactorReader

      @Inject ReactorReader(MavenSession session)
  • Method Details

    • getRepository

      public org.eclipse.aether.repository.WorkspaceRepository getRepository()
      Specified by:
      getRepository in interface org.eclipse.aether.repository.WorkspaceReader
    • findArtifact

      public File findArtifact(org.eclipse.aether.artifact.Artifact artifact)
      Specified by:
      findArtifact in interface org.eclipse.aether.repository.WorkspaceReader
    • findVersions

      public List<String> findVersions(org.eclipse.aether.artifact.Artifact artifact)
      Specified by:
      findVersions in interface org.eclipse.aether.repository.WorkspaceReader
    • findModel

      public Model findModel(org.eclipse.aether.artifact.Artifact artifact)
      Specified by:
      findModel in interface MavenWorkspaceReader
    • findArtifact

      private File findArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact artifact, boolean checkUptodate)
    • determineBuildOutputDirectoryForArtifact

      private File determineBuildOutputDirectoryForArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)
    • isPackagedArtifactUpToDate

      private boolean isPackagedArtifactUpToDate(MavenProject project, File packagedArtifactFile)
    • hasBeenPackagedDuringThisSession

      private boolean hasBeenPackagedDuringThisSession(MavenProject project)
    • relativizeOutputFile

      private Path relativizeOutputFile(Path outputFile)
    • findMatchingArtifact

      private org.eclipse.aether.artifact.Artifact findMatchingArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact requestedArtifact)
      Tries to resolve the specified artifact from the artifacts of the given project.
      Parameters:
      project - The project to try to resolve the artifact from, must not be null.
      requestedArtifact - The artifact to resolve, must not be null.
      Returns:
      The matching artifact from the project or null if not found. Note that this
    • isTestArtifact

      private static boolean isTestArtifact(org.eclipse.aether.artifact.Artifact artifact)
      Determines whether the specified artifact refers to test classes.
      Parameters:
      artifact - The artifact to check, must not be null.
      Returns:
      true if the artifact refers to test classes, false otherwise.
    • findInProjectLocalRepository

      private File findInProjectLocalRepository(org.eclipse.aether.artifact.Artifact artifact)
    • processEvent

      private void processEvent(ExecutionEvent event)
      We are interested in project success events, in which case we call the installIntoProjectLocalRepository(MavenProject) method. The mojo started event is also captured to determine the lifecycle phases the project has been through.
      Parameters:
      event - the execution event
    • getLifecycles

      private Deque<String> getLifecycles(MavenProject project)
    • installIntoProjectLocalRepository

      private void installIntoProjectLocalRepository(MavenProject project)
      Copy packaged and attached artifacts from this project to the project local repository. This allows a subsequent build to resume while still being able to locate attached artifacts.
      Parameters:
      project - the project to copy artifacts from
    • cleanProjectLocalRepository

      private void cleanProjectLocalRepository(MavenProject project)
    • getProjectArtifacts

      private Stream<org.eclipse.aether.artifact.Artifact> getProjectArtifacts(MavenProject project)
      Retrieve a stream of the project's artifacts
    • isRegularFile

      private boolean isRegularFile(org.eclipse.aether.artifact.Artifact artifact)
    • installIntoProjectLocalRepository

      private void installIntoProjectLocalRepository(org.eclipse.aether.artifact.Artifact artifact)
    • getArtifactPath

      private Path getArtifactPath(org.eclipse.aether.artifact.Artifact artifact)
    • getArtifactPath

      private Path getArtifactPath(String groupId, String artifactId, String version, String classifier, String extension)
    • getProjectLocalRepo

      private Path getProjectLocalRepo()
    • getProject

      private MavenProject getProject(org.eclipse.aether.artifact.Artifact artifact)
    • getAllProjects

      private Map<String,Map<String,Map<String,MavenProject>>> getAllProjects()
    • getProjects

      private Map<String,Map<String,Map<String,MavenProject>>> getProjects()