Class DependencyConvergenceAnalysis
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA dependency whose resolved version differs across subprojects. -
Method Summary
Modifier and TypeMethodDescriptionanalyze(Map<String, List<DependencyTreeParser.ResolvedDependency>> subprojectTrees) Analyze dependency trees from multiple subprojects for version divergence.static StringformatMarkdownReport(List<DependencyConvergenceAnalysis.Divergence> divergences, String workspaceName) Format divergences as a markdown report suitable for rendering as readable plugin output.
-
Method Details
-
analyze
public static List<DependencyConvergenceAnalysis.Divergence> analyze(Map<String, List<DependencyTreeParser.ResolvedDependency>> subprojectTrees) Analyze dependency trees from multiple subprojects for version divergence.For each unique
groupId:artifactIdthat 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 reportworkspaceName- the workspace name for the report title- Returns:
- markdown string, or empty string if no divergences
-