slachiewicz opened a new pull request, #322:
URL: https://github.com/apache/maven-dependency-analyzer/pull/322
<!-- Add your description here... what, why and how you resolve the issue -->
This is the rebased version of #69, the pull request Guillaume Nodet opened
in 2022 to switch
maven-dependency-analyzer to Maven 4 and the new API. The original branch
was based on a 2022
master and did not compile against the Maven 4 API as it exists today, so
the change has been
re-applied on top of the current master and brought up to date.
What the change does:
- `ProjectDependencyAnalyzer` takes a `Session` and a `Project` and resolves
the dependencies of
the project itself through the `DependencyResolver` service, because the
Maven 4 API has no
equivalent of `MavenProject.getArtifacts()`. The analysis reports
`org.apache.maven.api.Dependency`
instead of the Maven 3 `Artifact`.
- The components are injected with the Maven 4 dependency injection. The
`sisu-maven-plugin`
index is replaced by `META-INF/maven/org.apache.maven.api.di.Inject`.
- The class analysis accepts a `Path`, which is how the Maven 4 API hands
out the artifacts of a
project. `ClassFileVisitorUtils` reads a jar file through `ZipFile` when
it is given a path.
- The features that were added to master after the original pull request are
ported as well:
a declared artifact wins over an undeclared one for a class that several
artifacts provide
(#313), a declared artifact without classes of its own is credited when
one of the artifacts it
brings in is used (#314), and the used classes with their candidate
artifacts are exposed
(#280, #320).
The version is raised to 2.0.0-SNAPSHOT because the public API changes:
`analyze` takes a
`Session` and a `Project`, the analysis reports `Dependency` objects and the
class analysis is
done on `Path`s. The build requires Maven 4 and Java 17, and the CI workflow
now builds with
Maven 4 only.
The `Upgrade to JUnit 5` commit of the original pull request has been
dropped, master has been
using JUnit 5 for a long time.
Verified with `mvn -Prun-its verify` on Maven 4.0.0-rc-7: 149 unit tests and
23 integration
tests pass.
---
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](https://www.apache.org/licenses/LICENSE-2.0)
check one of the following:
- [x] I hereby declare this contribution to be licensed under the [Apache
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
- [ ] I hereby declare that I have filed an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]