Package org.apache.maven.graph
Class DefaultProjectDependencyGraph
- java.lang.Object
-
- org.apache.maven.graph.DefaultProjectDependencyGraph
-
- All Implemented Interfaces:
ProjectDependencyGraph
public class DefaultProjectDependencyGraph extends Object implements ProjectDependencyGraph
Describes the inter-dependencies between projects in the reactor.- Author:
- Benjamin Bentmann
-
-
Constructor Summary
Constructors Constructor Description DefaultProjectDependencyGraph(Collection<MavenProject> projects)
Creates a new project dependency graph based on the specified projects.DefaultProjectDependencyGraph(List<MavenProject> allProjects, Collection<MavenProject> projects)
Creates a new project dependency graph based on the specified projects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MavenProject>
getAllProjects()
Gets all collected projects.List<MavenProject>
getDownstreamProjects(MavenProject project, boolean transitive)
Gets the downstream projects of the specified project.List<MavenProject>
getSortedProjects()
Gets all projects in their intended build order, i.e.List<MavenProject>
getUpstreamProjects(MavenProject project, boolean transitive)
Gets the upstream projects of the specified project.String
toString()
-
-
-
Constructor Detail
-
DefaultProjectDependencyGraph
public DefaultProjectDependencyGraph(Collection<MavenProject> projects) throws org.codehaus.plexus.util.dag.CycleDetectedException, DuplicateProjectException
Creates a new project dependency graph based on the specified projects.- Parameters:
projects
- The projects to create the dependency graph with- Throws:
DuplicateProjectException
org.codehaus.plexus.util.dag.CycleDetectedException
-
DefaultProjectDependencyGraph
public DefaultProjectDependencyGraph(List<MavenProject> allProjects, Collection<MavenProject> projects) throws org.codehaus.plexus.util.dag.CycleDetectedException, DuplicateProjectException
Creates a new project dependency graph based on the specified projects.- Parameters:
allProjects
- All collected projects.projects
- The projects to create the dependency graph with.- Throws:
DuplicateProjectException
org.codehaus.plexus.util.dag.CycleDetectedException
- Since:
- 3.5.0
-
-
Method Detail
-
getAllProjects
public List<MavenProject> getAllProjects()
Description copied from interface:ProjectDependencyGraph
Gets all collected projects.- Specified by:
getAllProjects
in interfaceProjectDependencyGraph
- Returns:
- All collected projects.
- Since:
- 3.5.0
-
getSortedProjects
public List<MavenProject> getSortedProjects()
Description copied from interface:ProjectDependencyGraph
Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their inter-dependencies.- Specified by:
getSortedProjects
in interfaceProjectDependencyGraph
- Returns:
- The projects in the build order, never
null
.
-
getDownstreamProjects
public List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive)
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
public List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive)
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
.
-
-