Package org.apache.maven.graph
Class FilteredProjectDependencyGraph
java.lang.Object
org.apache.maven.graph.FilteredProjectDependencyGraph
- All Implemented Interfaces:
ProjectDependencyGraph
Provides a sub view of another dependency graph.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<FilteredProjectDependencyGraph.Key, List<MavenProject>> private final ProjectDependencyGraph
private final List
<MavenProject> private final Map
<MavenProject, ?> -
Constructor Summary
ConstructorsConstructorDescriptionFilteredProjectDependencyGraph
(ProjectDependencyGraph projectDependencyGraph, Collection<? extends MavenProject> whiteList) Creates a new project dependency graph from the specified graph. -
Method Summary
Modifier and TypeMethodDescriptionprivate List
<MavenProject> applyFilter
(Collection<? extends MavenProject> projects, boolean transitive, boolean upstream) Filter out whitelisted projects with a big twist: Assume we have all projectsa, b, c
while active area, c
and relation among all projects isa -> b -> c
.Gets all collected projects.getDownstreamProjects
(MavenProject project, boolean transitive) Gets the downstream projects of the specified project.Gets all projects in their intended build order, i.e.getUpstreamProjects
(MavenProject project, boolean transitive) Gets the upstream projects of the specified project.toString()
-
Field Details
-
projectDependencyGraph
-
whiteList
-
sortedProjects
-
cache
-
-
Constructor Details
-
FilteredProjectDependencyGraph
FilteredProjectDependencyGraph(ProjectDependencyGraph projectDependencyGraph, Collection<? extends MavenProject> whiteList) Creates a new project dependency graph from the specified graph.- Parameters:
projectDependencyGraph
- The project dependency graph to create a sub view from, must not benull
.whiteList
- The projects on which the dependency view should focus, must not benull
.
-
-
Method Details
-
getAllProjects
Description copied from interface:ProjectDependencyGraph
Gets all collected projects.- Specified by:
getAllProjects
in interfaceProjectDependencyGraph
- Returns:
- All collected projects.
- Since:
- 3.5.0
-
getSortedProjects
Description copied from interface:ProjectDependencyGraph
Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their interdependencies.- Specified by:
getSortedProjects
in interfaceProjectDependencyGraph
- Returns:
- The projects in the build order, never
null
.
-
getDownstreamProjects
Description copied from interface:ProjectDependencyGraph
Gets the downstream projects of the specified project. A downstream project is a project that directly or indirectly depends on the given project.- Specified by:
getDownstreamProjects
in interfaceProjectDependencyGraph
- Parameters:
project
- The project whose downstream projects should be retrieved, must not benull
.transitive
- A flag whether to retrieve all direct and indirect downstream projects or just the immediate downstream projects.- Returns:
- The downstream projects in the build order, never
null
.
-
getUpstreamProjects
Description copied from interface:ProjectDependencyGraph
Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly is a prerequisite of the given project.- Specified by:
getUpstreamProjects
in interfaceProjectDependencyGraph
- Parameters:
project
- The project whose upstream projects should be retrieved, must not benull
.transitive
- A flag whether to retrieve all direct and indirect upstream projects or just the immediate upstream projects.- Returns:
- The upstream projects in the build order, never
null
.
-
applyFilter
private List<MavenProject> applyFilter(Collection<? extends MavenProject> projects, boolean transitive, boolean upstream) Filter out whitelisted projects with a big twist: Assume we have all projectsa, b, c
while active area, c
and relation among all projects isa -> b -> c
. This method handles well the case for transitive list. But, for non-transitive we need to "pull in" transitive dependencies of eliminated projects, as for case above, the properly filtered list would bea -> c
.Original code would falsely report
a
project as "without dependencies", basically would lose link due filtering. This causes build ordering issues in concurrent builders. -
toString
-