Package org.apache.maven
Class ReactorReader
- java.lang.Object
-
- org.apache.maven.ReactorReader
-
- All Implemented Interfaces:
MavenWorkspaceReader,org.eclipse.aether.repository.WorkspaceReader
@Named("reactor") class ReactorReader extends java.lang.Object implements MavenWorkspaceReaderAn 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 Summary
Fields Modifier and Type Field Description private static java.util.Collection<java.lang.String>COMPILE_PHASE_TYPESstatic java.lang.StringHINTstatic java.lang.StringPROJECT_LOCAL_REPOprivate java.util.function.Function<MavenProject,java.lang.String>projectIntoKeyprivate java.util.function.Function<MavenProject,java.lang.String>projectIntoVersionlessKeyprivate java.util.Map<java.lang.String,java.util.List<MavenProject>>projectsByGAprivate java.util.Map<java.lang.String,MavenProject>projectsByGAVprivate org.eclipse.aether.repository.WorkspaceRepositoryrepositoryprivate MavenSessionsession
-
Constructor Summary
Constructors Constructor Description ReactorReader(MavenSession session)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.io.FiledeterminePreviouslyPackagedArtifactFile(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)private java.io.Filefind(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)java.io.FilefindArtifact(org.eclipse.aether.artifact.Artifact artifact)private org.eclipse.aether.artifact.ArtifactfindMatchingArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact requestedArtifact)Tries to resolve the specified artifact from the artifacts of the given project.ModelfindModel(org.eclipse.aether.artifact.Artifact artifact)java.util.List<java.lang.String>findVersions(org.eclipse.aether.artifact.Artifact artifact)org.eclipse.aether.repository.WorkspaceRepositorygetRepository()private booleanhasArtifactFileFromPackagePhase(org.eclipse.aether.artifact.Artifact projectArtifact)private booleanhasBeenPackaged(MavenProject project)private java.util.function.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().private static booleanisTestArtifact(org.eclipse.aether.artifact.Artifact artifact)Determines whether the specified artifact refers to test classes.
-
-
-
Field Detail
-
HINT
public static final java.lang.String HINT
- See Also:
- Constant Field Values
-
PROJECT_LOCAL_REPO
public static final java.lang.String PROJECT_LOCAL_REPO
- See Also:
- Constant Field Values
-
COMPILE_PHASE_TYPES
private static final java.util.Collection<java.lang.String> COMPILE_PHASE_TYPES
-
session
private final MavenSession session
-
projectsByGAV
private final java.util.Map<java.lang.String,MavenProject> projectsByGAV
-
projectsByGA
private final java.util.Map<java.lang.String,java.util.List<MavenProject>> projectsByGA
-
repository
private final org.eclipse.aether.repository.WorkspaceRepository repository
-
projectIntoKey
private java.util.function.Function<MavenProject,java.lang.String> projectIntoKey
-
projectIntoVersionlessKey
private java.util.function.Function<MavenProject,java.lang.String> projectIntoVersionlessKey
-
-
Constructor Detail
-
ReactorReader
@Inject ReactorReader(MavenSession session)
-
-
Method Detail
-
getRepository
public org.eclipse.aether.repository.WorkspaceRepository getRepository()
- Specified by:
getRepositoryin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findArtifact
public java.io.File findArtifact(org.eclipse.aether.artifact.Artifact artifact)
- Specified by:
findArtifactin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findVersions
public java.util.List<java.lang.String> findVersions(org.eclipse.aether.artifact.Artifact artifact)
- Specified by:
findVersionsin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findModel
public Model findModel(org.eclipse.aether.artifact.Artifact artifact)
- Specified by:
findModelin interfaceMavenWorkspaceReader
-
find
private java.io.File find(MavenProject project, org.eclipse.aether.artifact.Artifact artifact)
-
determinePreviouslyPackagedArtifactFile
private java.io.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 benull.requestedArtifact- The artifact to resolve, must not benull.- Returns:
- The matching artifact from the project or
nullif not found. Note that this
-
isRequestedArtifact
private java.util.function.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 benull.- Returns:
trueif the artifact refers to test classes,falseotherwise.
-
-