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 class
Singleton class used to receive events by implementing the EventSpy. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Collection
<String> static final String
private static final org.slf4j.Logger
static final String
private Path
private final org.eclipse.aether.repository.WorkspaceRepository
private final MavenSession
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
cleanProjectLocalRepository
(MavenProject project) private File
determineBuildOutputDirectoryForArtifact
(MavenProject project, org.eclipse.aether.artifact.Artifact artifact) private File
findArtifact
(MavenProject project, org.eclipse.aether.artifact.Artifact artifact, boolean checkUptodate) findArtifact
(org.eclipse.aether.artifact.Artifact artifact) private File
findInProjectLocalRepository
(org.eclipse.aether.artifact.Artifact artifact) 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.findModel
(org.eclipse.aether.artifact.Artifact artifact) findVersions
(org.eclipse.aether.artifact.Artifact artifact) private Path
getArtifactPath
(String groupId, String artifactId, String version, String classifier, String extension) private Path
getArtifactPath
(org.eclipse.aether.artifact.Artifact artifact) getLifecycles
(MavenProject project) private MavenProject
getProject
(org.eclipse.aether.artifact.Artifact artifact) private Stream
<org.eclipse.aether.artifact.Artifact> getProjectArtifacts
(MavenProject project) Retrieve a stream of the project's artifactsprivate Path
org.eclipse.aether.repository.WorkspaceRepository
private boolean
private void
Copy packaged and attached artifacts from this project to the project local repository.private void
installIntoProjectLocalRepository
(org.eclipse.aether.artifact.Artifact artifact) private boolean
isPackagedArtifactUpToDate
(MavenProject project, File packagedArtifactFile) private boolean
isRegularFile
(org.eclipse.aether.artifact.Artifact artifact) private static boolean
isTestArtifact
(org.eclipse.aether.artifact.Artifact artifact) Determines whether the specified artifact refers to test classes.private void
processEvent
(ExecutionEvent event) We are interested in project success events, in which case we call theinstallIntoProjectLocalRepository(MavenProject)
method.private Path
relativizeOutputFile
(Path outputFile) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getRepository
in interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findArtifact
- Specified by:
findArtifact
in interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findVersions
- Specified by:
findVersions
in interfaceorg.eclipse.aether.repository.WorkspaceReader
-
findModel
- Specified by:
findModel
in 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
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 benull
.- Returns:
true
if the artifact refers to test classes,false
otherwise.
-
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
-