public class LaunchOrderDependencyNodeVisitor
This DepepdencyVistor traverses depedency tree in depth-first manner. Visitor
needs two collections: nodesByArtifactId and versionsByArtifactId which map
respective stringified artifact representations to DependencyNodes. If
visitor encounters node which was omitted, then it checks the reason for
omitting. If it was omitted because of duplication then visitor looks up the
kept node and continues traversing from it. If it was omitted because of
conflict then an exception with meaningful message is thrown, unless the
visitor is instructed to not throw exception by passing
throwExceptionOnConflict parameter to the constructor.
After ending a visit to node which was not ommitted the node's artifact is
converted to mvn url and aded to mvnUrls list. If the artifact is not a
bundle then mvn url is preceded with "wrap:" protocol. After visit is ended
all mvnUrls in required launch order are contained in mvnUrl list.
nodesByArtifactId - mapping of stringified artifacts (groupId + artifactId +
version) to nodes in the dependency tree. Nodes contain
information about children. Duplicates of nodes are not
included in the mapping.
versionsByArtifactId - mapping of stringified artifacts without version (groupId +
artifactId) to stringified artifacts with version.
throwExceptionOnConflict - flag which turns turning exception on conflict
localRepository - maven local repository
artifactResolver - maven artifact resolver
dontResolve - artifact which should not be resolved
protected final void addNode(org.apache.maven.shared.dependency.tree.DependencyNode node)
Adds node to the execution list.
node - which should be added.
public final boolean visit(org.apache.maven.shared.dependency.tree.DependencyNode node)
If this method returns true then it means that nodes children should be
visited. True is returned only if node is in scope and if it was not
ommited. It is ensured that node with given groupId, artifactId and
version is visited only once.
When visiting node omitted because of conflict, exception is thrown if
throwExceptionOnConflict property is true. In case
throwExceptionOnConflict is false, the conflict is resolved as suggested
by the tree and kept artifact is finally added to mvnUrls list.
visit in interface org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor
node - which should be checked for need of visiting
true if node needs visiting, false otherwise
public final boolean endVisit(org.apache.maven.shared.dependency.tree.DependencyNode node)
If this method returns true then it means that the next sibling should be
visited. Because all nodes should be visited this methods always returns
If node wasn't visited, it is in the scope, and was not omitted then it
is added to mvnUrls list.
endVisit in interface org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor