Class CycleAwareDependencyGraphDumper
java.lang.Object
org.eclipse.aether.util.graph.visitor.DependencyGraphDumper
org.eclipse.aether.util.graph.visitor.CycleAwareDependencyGraphDumper
- All Implemented Interfaces:
DependencyVisitor
A
DependencyGraphDumper that is safe to use on a graph containing cycles: a dependency graph in
FULL verbosity mode may contain nodes that (directly or transitively) depend on an ancestor of
themselves, which makes the plain DependencyGraphDumper recurse forever. Wrapping it in
TreeDependencyVisitor avoids the stack overflow but also hides every node that was already visited
anywhere else in the graph, so a node reached a second time through a different path (a perfectly normal
diamond dependency, not a cycle) is silently dropped from the output as well.
This dumper only checks the path from the root to the node currently being visited: a node is only treated as a cycle when it is already one of its own ancestors. Diamonds are still printed in full, and a true cycle is printed once, marked, with its subtree cut off instead of being recursed into.
- Since:
- 2.0.25
-
Field Summary
Fields inherited from class DependencyGraphDumper
consumer, nodes -
Constructor Summary
ConstructorsConstructorDescriptionCycleAwareDependencyGraphDumper(Consumer<String> consumer) Creates instance with given consumer.CycleAwareDependencyGraphDumper(Consumer<String> consumer, Collection<Function<DependencyNode, String>> decorators) Creates instance with given consumer and decorators. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvisitEnter(DependencyNode node) Notifies the visitor of a node visit before its children have been processed.
-
Constructor Details
-
CycleAwareDependencyGraphDumper
Creates instance with given consumer.- Parameters:
consumer- the string consumer, must not benull
-
CycleAwareDependencyGraphDumper
public CycleAwareDependencyGraphDumper(Consumer<String> consumer, Collection<Function<DependencyNode, String>> decorators) Creates instance with given consumer and decorators.- Parameters:
consumer- the string consumer, must not benulldecorators- the decorators to apply, must not benull
-
-
Method Details
-
visitEnter
Description copied from interface:DependencyVisitorNotifies the visitor of a node visit before its children have been processed.- Specified by:
visitEnterin interfaceDependencyVisitor- Overrides:
visitEnterin classDependencyGraphDumper- Parameters:
node- The dependency node being visited, must not benull.- Returns:
trueto visit child nodes of the specified node as well,falseto skip children.
-