Use the analyzer 1.18 API in analyze mojos (#1815) 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 (apache/maven-dependency-analyzer#345). - `ForcedUsage` and `AnalyzeDepMgt` use `ArtifactKeys.groupArtifactId` in place of their own key logic. Note: analyzer 1.18.0 also changes analysis results. A declared artifact now wins over an undeclared one when both contain a used class, and declared class-less aggregators (for example junit-jupiter) are credited as used through their direct children. Builds using `failOnWarning` can therefore report different used-undeclared / unused-declared dependencies after upgrading.
The Maven plugin for working with a project's dependencies: it displays the dependency tree, analyzes declared and used dependencies, copies and unpacks artifacts, builds class paths, resolves artifacts without a project, and adds or removes dependencies in a pom.xml. It requires Maven 3.9.0 or later and Java 8 or later.
mvn dependency:tree mvn dependency:analyze mvn dependency:copy-dependencies -DincludeScope=runtime mvn dependency:get -Dartifact=org.apache.commons:commons-collections4:4.4
Build and run the unit tests:
mvn verify
Run the integration tests in src/it as well, all of them or one by name:
mvn -Prun-its verify mvn -Prun-its verify -Dinvoker.test=tree-show-sizes
Build the site into target/site:
mvn -DskipTests install site
Open a pull request against master with a test that covers the change, and run mvn spotless:apply before you commit. Discuss larger changes on the developer mailing list first. See the guide to helping with Maven for more.