Class DependencyConvergenceAnalysis

java.lang.Object
network.ike.workspace.DependencyConvergenceAnalysis

public final class DependencyConvergenceAnalysis extends Object
Compare resolved dependency trees across workspace subprojects to detect version divergence.

When multiple subprojects in a workspace resolve the same groupId:artifactId to different versions, that divergence can cause classpath conflicts in assembled applications (e.g., a desktop application that depends on several workspace libraries).

This analysis operates on the resolved dependency trees (output of mvn dependency:tree), not the declared POMs. This means it catches divergence introduced by transitive dependencies, BOM imports, and Maven's nearest-wins resolution.

  • Method Details

    • analyze

      Analyze dependency trees from multiple subprojects for version divergence.

      For each unique groupId:artifactId that appears in more than one subproject's tree, checks whether the resolved version is the same. Returns only those artifacts where at least two different versions are resolved.

      The root artifact of each subproject (depth 0) is excluded from comparison — those are expected to differ.

      Parameters:
      subprojectTrees - map from subproject name to its parsed dependency tree
      Returns:
      list of divergences, sorted by coordinate
    • formatMarkdownReport

      public static String formatMarkdownReport(List<DependencyConvergenceAnalysis.Divergence> divergences, String workspaceName)
      Format divergences as a markdown report suitable for rendering as readable plugin output.

      Produces a markdown document with a summary table and per-artifact detail sections. The format is designed to be readable both in terminal output and when rendered as HTML.

      Parameters:
      divergences - the divergences to report
      workspaceName - the workspace name for the report title
      Returns:
      markdown string, or empty string if no divergences