Class ArtifactTransitivityFilter
java.lang.Object
org.apache.maven.shared.artifact.filter.collection.AbstractArtifactsFilter
org.apache.maven.shared.artifact.filter.collection.ArtifactTransitivityFilter
- All Implemented Interfaces:
ArtifactsFilter
This filter will exclude everything that is not a dependency of the selected artifact.
- Author:
- Brian Fox
-
Constructor Summary
ConstructorDescriptionArtifactTransitivityFilter
(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.ProjectBuildingRequest buildingRequest, org.apache.maven.project.ProjectBuilder projectBuilder) UseMavenSession.getProjectBuildingRequest()
to get the buildingRequest. -
Method Summary
Modifier and TypeMethodDescriptionboolean
artifactIsATransitiveDependency
(org.apache.maven.artifact.Artifact artifact) Compares the artifact to the list of dependencies to see if it is directly included by this projectSet<org.apache.maven.artifact.Artifact>
filter.Methods inherited from class org.apache.maven.shared.artifact.filter.collection.AbstractArtifactsFilter
isArtifactIncluded
-
Constructor Details
-
ArtifactTransitivityFilter
public ArtifactTransitivityFilter(org.apache.maven.artifact.Artifact artifact, org.apache.maven.project.ProjectBuildingRequest buildingRequest, org.apache.maven.project.ProjectBuilder projectBuilder) throws org.apache.maven.project.ProjectBuildingException Use
MavenSession.getProjectBuildingRequest()
to get the buildingRequest. The projectBuilder should be resolved with CDI.// For Mojo @Component private ProjectBuilder projectBuilder; // For Components @Requirement // or @Inject private ProjectBuilder projectBuilder;
- Parameters:
artifact
- the artifact to resolve the dependencies frombuildingRequest
- the buildingRequestprojectBuilder
- the projectBuilder- Throws:
org.apache.maven.project.ProjectBuildingException
- if the project descriptor could not be successfully built
-
-
Method Details
-
filter
public Set<org.apache.maven.artifact.Artifact> filter(Set<org.apache.maven.artifact.Artifact> artifacts) filter.
- Parameters:
artifacts
-Artifact
- Returns:
- Set of artifacts.
-
artifactIsATransitiveDependency
public boolean artifactIsATransitiveDependency(org.apache.maven.artifact.Artifact artifact) Compares the artifact to the list of dependencies to see if it is directly included by this project- Parameters:
artifact
- representing the item to compare.- Returns:
- true if artifact is a transitive dependency
-