Class CycleAwareDependencyGraphDumper
- java.lang.Object
-
- org.eclipse.aether.util.graph.visitor.DependencyGraphDumper
-
- org.eclipse.aether.util.graph.visitor.CycleAwareDependencyGraphDumper
-
- All Implemented Interfaces:
org.eclipse.aether.graph.DependencyVisitor
public class CycleAwareDependencyGraphDumper extends DependencyGraphDumper
ADependencyGraphDumperthat is safe to use on a graph containing cycles: a dependency graph inFULLverbosity mode may contain nodes that (directly or transitively) depend on an ancestor of themselves, which makes the plainDependencyGraphDumperrecurse forever. Wrapping it inTreeDependencyVisitoravoids 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 org.eclipse.aether.util.graph.visitor.DependencyGraphDumper
consumer, nodes
-
-
Constructor Summary
Constructors Constructor Description CycleAwareDependencyGraphDumper(java.util.function.Consumer<java.lang.String> consumer)Creates instance with given consumer.CycleAwareDependencyGraphDumper(java.util.function.Consumer<java.lang.String> consumer, java.util.Collection<java.util.function.Function<org.eclipse.aether.graph.DependencyNode,java.lang.String>> decorators)Creates instance with given consumer and decorators.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanvisitEnter(org.eclipse.aether.graph.DependencyNode node)-
Methods inherited from class org.eclipse.aether.util.graph.visitor.DependencyGraphDumper
artifactProperties, defaultsWith, effectiveDependency, formatIndentation, formatLine, formatNode, premanagedExclusions, premanagedOptional, premanagedProperties, premanagedScope, premanagedVersion, rangeMember, visitLeave, winnerNode
-
-
-
-
Constructor Detail
-
CycleAwareDependencyGraphDumper
public CycleAwareDependencyGraphDumper(java.util.function.Consumer<java.lang.String> consumer)
Creates instance with given consumer.- Parameters:
consumer- the string consumer, must not benull
-
CycleAwareDependencyGraphDumper
public CycleAwareDependencyGraphDumper(java.util.function.Consumer<java.lang.String> consumer, java.util.Collection<java.util.function.Function<org.eclipse.aether.graph.DependencyNode,java.lang.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 Detail
-
visitEnter
public boolean visitEnter(org.eclipse.aether.graph.DependencyNode node)
- Specified by:
visitEnterin interfaceorg.eclipse.aether.graph.DependencyVisitor- Overrides:
visitEnterin classDependencyGraphDumper
-
-