Package org.apache.maven
Class ReactorReader
java.lang.Object
org.apache.maven.ReactorReader
- All Implemented Interfaces:
MavenWorkspaceReader,org.eclipse.aether.repository.WorkspaceReader
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classSingleton class used to receive events by implementing the EventSpy. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Collection<String> static final Stringprivate static final org.slf4j.Loggerstatic final Stringprivate Pathprivate final org.eclipse.aether.repository.WorkspaceRepositoryprivate final MavenSession -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcleanProjectLocalRepository(MavenProject project) private FiledetermineBuildOutputDirectoryForArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact artifact) private FilefindArtifact(MavenProject project, org.eclipse.aether.artifact.Artifact artifact, boolean checkUptodate) findArtifact(org.eclipse.aether.artifact.Artifact artifact) private FilefindInProjectLocalRepository(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.findModel(org.eclipse.aether.artifact.Artifact artifact) findVersions(org.eclipse.aether.artifact.Artifact artifact) private PathgetArtifactPath(String groupId, String artifactId, String version, String classifier, String extension) private PathgetArtifactPath(org.eclipse.aether.artifact.Artifact artifact) getLifecycles(MavenProject project) private MavenProjectgetProject(org.eclipse.aether.artifact.Artifact artifact) private Stream<org.eclipse.aether.artifact.Artifact> getProjectArtifacts(MavenProject project) Retrieve a stream of the project's artifactsprivate Pathorg.eclipse.aether.repository.WorkspaceRepositoryprivate booleanprivate voidCopy packaged and attached artifacts from this project to the project local repository.private voidinstallIntoProjectLocalRepository(org.eclipse.aether.artifact.Artifact artifact) private booleanisPackagedArtifactUpToDate(MavenProject project, File packagedArtifactFile) private booleanisRegularFile(org.eclipse.aether.artifact.Artifact artifact) private static booleanisTestArtifact(org.eclipse.aether.artifact.Artifact artifact) Determines whether the specified artifact refers to test classes.private voidprocessEvent(ExecutionEvent event) We are interested in project success events, in which case we call theinstallIntoProjectLocalRepository(MavenProject)method.private PathrelativizeOutputFile(Path outputFile) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.aether.repository.WorkspaceReader
findArtifactPath
-
Field Details
-
HINT
- See Also:
-
PROJECT_LOCAL_REPO
- See Also:
-
COMPILE_PHASE_TYPES
-
LOGGER
private static final org.slf4j.Logger LOGGER -
session
-
repository
private final org.eclipse.aether.repository.WorkspaceRepository repository -
projects
-
allProjects
-
projectLocalRepository
-
lifecycles
-
-
Constructor Details
-
ReactorReader
-
-
Method Details
-
getRepository
public org.eclipse.aether.repository.WorkspaceRepository getRepository()- Specified by:
getRepositoryin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findArtifact
- Specified by:
findArtifactin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findVersions
- Specified by:
findVersionsin interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findModel
- Specified by:
findModelin interfaceMavenWorkspaceReader
-
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
-
hasBeenPackagedDuringThisSession
-
relativizeOutputFile
-
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
-
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.
-
findInProjectLocalRepository
-
processEvent
We are interested in project success events, in which case we call theinstallIntoProjectLocalRepository(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
-
installIntoProjectLocalRepository
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
-
getProjectArtifacts
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
-
getArtifactPath
-
getProjectLocalRepo
-
getProject
-
getAllProjects
-
getProjects
-