Skip to content

Use the analyzer 1.18 API in analyze mojos - #1815

Draft
slachiewicz wants to merge 2 commits into
apache:masterfrom
slachiewicz:agent/analyzer-api-migration
Draft

slachiewicz wants to merge 2 commits into
apache:masterfrom
slachiewicz:agent/analyzer-api-migration

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Moves the analyze goals to the API of maven-dependency-analyzer 1.18.0 and shows the class-level data it adds.

  • With verbose, analyze and analyze-only list the used classes that more than one dependency contains, with the dependency the analysis selected, and the used classes that no dependency contains. Both are info lines and do not count as warnings for failOnWarning.
  • analyze-report gets an Ambiguous Used Classes section (class, candidate artifacts, selected artifact) and a Used Classes Not Found in Any Dependency section.
  • The verbose "used by" lines read the usages after usedDependencies is applied; 1.18.0 keeps them when usage is forced (Keep the usages of used declared dependencies when forcing usage maven-dependency-analyzer#345).
  • ForcedUsage and AnalyzeDepMgt use ArtifactKeys.groupArtifactId in place of their own key logic.

The analyzer is pinned to 1.18.0-SNAPSHOT. This PR stays in draft until 1.18.0 is released and the pin is changed to it.

Verified: mvn -Prun-its verify on JDK 17 against analyzer master → 764 tests, 122/122 ITs. No IT has an ambiguous or unmapped class, so the new output is covered by unit tests only.

@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
@slachiewicz
slachiewicz force-pushed the agent/analyzer-api-migration branch from e7daf9a to cc0cde0 Compare November 21, 2026 20:12
Bump the analyzer to 1.18.0. 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.
From analyzer 1.18.0 on, forceDeclaredDependenciesUsage keeps the usages
of the dependencies already detected as used, so the usages are read
after the force. Restore the read-before-force order if the analyzer is
ever moved back below 1.18.0.

The analyzer is pinned to 1.18.0-SNAPSHOT until 1.18.0 is released.
@slachiewicz
slachiewicz force-pushed the agent/analyzer-api-migration branch from cc0cde0 to 82d25c1 Compare November 22, 2026 00:02
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