Skip to content

Use the analyzer 1.18 API in analyze mojos - #1815

Draft
slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:agent/analyzer-api-migration
Draft

slachiewicz wants to merge 1 commit into
apache:masterfrom
slachiewicz:agent/analyzer-api-migration

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Summary

Migrates maven-dependency-plugin to the analyzer API added for 1.18.0 in the 1.17.3-SNAPSHOT build:

  • Bumps maven-dependency-analyzer from 1.17.2 to 1.17.3-SNAPSHOT.
  • Replaces the duplicated groupId:artifactId key logic in ForcedUsage and AnalyzeDepMgt with ArtifactKeys.groupArtifactId.
  • Adds an Ambiguous Used Classes section to analyze-report using getAmbiguousUsedDependencyClasses(), getCandidateArtifactsByUsedClass(), and getSelectedArtifactByUsedClass(). The table lists each class, the artifacts that provide it, and the artifact the analyzer selected.

The low-level ClassEntrySource and Path overloads don't apply here. The plugin consumes the high-level ProjectDependencyAnalyzer SPI, so no analyzer signature changes are needed. The class-level data comes from apache/maven-dependency-analyzer#320.

Verification

  • mvn -B -o -Dtest=AnalyzeReportRendererTest test: 2 tests pass.
  • mvn -B -o -Prun-its verify on JDK 21 with the snapshot installed locally: 756 unit tests and 122 ITs pass, with no failures or errors.
  • mvn spotless:apply and mvn -N spotless:check pass on JDK 17.

Merge blocker

This PR stays in draft until the analyzer release is published. GitHub Actions can't resolve 1.17.3-SNAPSHOT because the plugin doesn't declare an Apache snapshots repository. Before marking this PR ready, publish the analyzer release and change the dependency to the released version.

Bump the analyzer to the 1.17.3-SNAPSHOT build that carries the
1.18.0 API. Replace duplicated group-and-artifact key logic with
ArtifactKeys.groupArtifactId and render ambiguous used classes with
the candidate and selected artifact data exposed by ProjectDependencyAnalysis.
@slachiewicz slachiewicz added enhancement New feature or request dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant