Package org.apache.maven.project
Class ProjectSorter
- java.lang.Object
-
- org.apache.maven.project.ProjectSorter
-
public class ProjectSorter extends Object
ProjectSorter
-
-
Constructor Summary
Constructors Constructor Description ProjectSorter(Collection<MavenProject> projects)
Sort a list of projects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.codehaus.plexus.util.dag.DAG
getDAG()
List<String>
getDependencies(String id)
List<String>
getDependents(String id)
static String
getId(MavenProject project)
Map<String,MavenProject>
getProjectMap()
List<MavenProject>
getSortedProjects()
MavenProject
getTopLevelProject()
boolean
hasMultipleProjects()
-
-
-
Constructor Detail
-
ProjectSorter
public ProjectSorter(Collection<MavenProject> projects) throws org.codehaus.plexus.util.dag.CycleDetectedException, DuplicateProjectException
Sort a list of projects.- collect all the vertices for the projects that we want to build.
- iterate through the deps of each project and if that dep is within the set of projects we want to build then add an edge, otherwise throw the edge away because that dependency is not within the set of projects we are trying to build. we assume a closed set.
- do a topo sort on the graph that remains.
- Throws:
DuplicateProjectException
- if any projects are duplicated by idorg.codehaus.plexus.util.dag.CycleDetectedException
-
-
Method Detail
-
getTopLevelProject
public MavenProject getTopLevelProject()
-
getSortedProjects
public List<MavenProject> getSortedProjects()
-
hasMultipleProjects
public boolean hasMultipleProjects()
-
getId
public static String getId(MavenProject project)
-
getDAG
public org.codehaus.plexus.util.dag.DAG getDAG()
-
getProjectMap
public Map<String,MavenProject> getProjectMap()
-
-