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

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
  • Constructor Details

  • Method Details

    • visitEnter

      public boolean visitEnter(org.eclipse.aether.graph.DependencyNode node)
      Specified by:
      visitEnter in interface org.eclipse.aether.graph.DependencyVisitor
      Overrides:
      visitEnter in class DependencyGraphDumper