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

      private File find(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)
    • determinePreviouslyPackagedArtifactFile

      private File determinePreviouslyPackagedArtifactFile(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)
    • hasArtifactFileFromPackagePhase

      private boolean hasArtifactFileFromPackagePhase(org.eclipse.aether.artifact.Artifact projectArtifact)
    • hasBeenPackaged

      private boolean hasBeenPackaged(MavenProject project)
    • 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
    • isRequestedArtifact

      private Predicate<org.eclipse.aether.artifact.Artifact> isRequestedArtifact(org.eclipse.aether.artifact.Artifact requestArtifact)
      We are taking as much as we can from the DefaultArtifact.equals(). The requested artifact has no file, so we want to remove that from the comparison.
      Parameters:
      requestArtifact - checked against the given artifact.
      Returns:
      true if equals, false otherwise.
    • 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.