|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvnet.maven.plugin.antrun.DependencyGraph
public final class DependencyGraph
Graph of dependencies among Maven artifacts.
This graph, which consists of interconnected DependencyGraph.Nodes and DependencyGraph.Edges,
represents a complete dependency graph rooted at the given Maven module.
The constructor recursively parses all POMs for the dependency and builds this information.
For example, if you have 4 modules A,B,C, and D that has the dependencies among them as follows:
A->B,C B->D C->D
Then if you construct a graph from 'A', you'll get a graph of four nodes (each representing maven module A,B,C, and D) and four edges (each representing dependencies among them.)
Once constructed, a graph is accessible in several ways:
the root node and traverse through edges like
DependencyGraph.Node.getForwardEdges(DependencyGraph).
createSubGraph(GraphVisitor) and obtain a sub-graph that matches the given
criteria.
| Nested Class Summary | |
|---|---|
static class |
DependencyGraph.Edge
|
static class |
DependencyGraph.Node
Node, which represents an artifact. |
| Constructor Summary | |
|---|---|
DependencyGraph(org.apache.maven.artifact.Artifact root,
boolean tolerateBrokenPOMs)
Creates a full dependency graph with the given artifact at the top. |
|
DependencyGraph(org.apache.maven.project.MavenProject root,
boolean tolerateBrokenPOMs)
Creates a full dependency graph with the given project at the top. |
|
| Method Summary | |
|---|---|
void |
accept(GraphVisitor visitor)
Accepts the visitor. |
boolean |
contains(DependencyGraph.Node node)
Checks if the graph contains the given node. |
DependencyGraph |
createSubGraph(DependencyGraph.Node root)
Creates a full subgraph rooted at the given node. |
DependencyGraph |
createSubGraph(DependencyGraph.Node root,
java.util.Collection<DependencyGraph.Node> nodes)
Creates a sub-graph from the given set of nodes (which must be subset of nodes in the current graph) with all edges { (u,v) | u \in nodes, v \in nodes } |
DependencyGraph |
createSubGraph(DependencyGraph.Node node,
GraphVisitor visitor)
Visits the graph started at the given node, and creates a sub-graph from visited nodes and edges. |
DependencyGraph |
createSubGraph(GraphVisitor visitor)
Accepts the visitor and invoke its visitor methods to create a sub-graph. |
java.util.Collection<DependencyGraph.Node> |
getAllNodes()
Returns all nodes in this graph. |
DependencyGraph.Node |
getRoot()
Gets the root node. |
boolean |
isEmpty()
Returns true if the graph contains nothing at all. |
DependencyGraph.Node |
toNode(org.apache.maven.artifact.Artifact a)
Gets the associated DependencyGraph.Node, or null if none exists. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DependencyGraph(org.apache.maven.artifact.Artifact root,
boolean tolerateBrokenPOMs)
throws org.apache.maven.project.ProjectBuildingException,
org.apache.maven.artifact.resolver.ArtifactResolutionException,
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.ProjectBuildingException
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
public DependencyGraph(org.apache.maven.project.MavenProject root,
boolean tolerateBrokenPOMs)
throws org.apache.maven.project.ProjectBuildingException,
org.apache.maven.artifact.resolver.ArtifactResolutionException,
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.ProjectBuildingException
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException| Method Detail |
|---|
public DependencyGraph.Node getRoot()
This is non-null unless this graph is empty.
public boolean isEmpty()
public java.util.Collection<DependencyGraph.Node> getAllNodes()
public boolean contains(DependencyGraph.Node node)
public DependencyGraph.Node toNode(org.apache.maven.artifact.Artifact a)
throws org.apache.maven.project.ProjectBuildingException,
org.apache.maven.artifact.resolver.ArtifactResolutionException,
org.apache.maven.artifact.resolver.ArtifactNotFoundException
DependencyGraph.Node, or null if none exists.
org.apache.maven.project.ProjectBuildingException
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundExceptionpublic DependencyGraph createSubGraph(GraphVisitor visitor)
This method is convenient for obtaining a sub-graph of dependencies by filtering out nodes/edges. For example, to obtain all the transitive dependencies that exclude provided/test dependencies, you can do:
createSubgraph(new ScopeFilter("compile","runtime"))
public void accept(GraphVisitor visitor)
createSubGraph(GraphVisitor).
public DependencyGraph createSubGraph(DependencyGraph.Node root)
public DependencyGraph createSubGraph(DependencyGraph.Node node,
GraphVisitor visitor)
This is the slightly generalized version of createSubGraph(GraphVisitor)
public DependencyGraph createSubGraph(DependencyGraph.Node root,
java.util.Collection<DependencyGraph.Node> nodes)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||