wilx opened a new pull request, #1667:
URL: https://github.com/apache/maven-dependency-plugin/pull/1667
## Summary
Allow `dependency:copy` and `dependency:unpack` artifact items to omit their
version when the artifact is present only as a transitive project dependency.
The existing direct-dependency and dependency-management lookups remain
authoritative. If neither supplies a version, the plugin lazily collects the
requested compile, runtime, or test dependency graph through Maven Resolver and
looks up the selected artifact version. An optional `dependencyScope` setting
resolves cases where different classpaths select different versions; without
it, conflicting selections are reported rather than guessed.
Artifact matching first uses the complete group ID, artifact ID, type, and
classifier coordinates and then preserves the existing GA fallback. The
resolved graphs are cached per scope in immutable GA-indexed maps. Existing
relocation behavior is retained because the original model coordinates are
checked before Resolver's post-relocation graph.
This implementation uses the Maven shared dependency graph APIs supported by
both Maven 3.x and Maven 4.x.
Fixes #1240.
## Verification
- `mvn verify` — 415 tests passed, with one existing skip.
- `mvn -Prun-its verify` — all 103 integration projects passed.
- Focused `mdep-726-*`, `copy-relocation`, and `unpack-relocation`
integration tests passed with:
- Maven 3.6.3 on JDK 8
- Maven 3.9.16 on JDK 21
- Maven 4.0.0-rc-5 on JDK 21
- Spotless, Checkstyle, Apache RAT, dependency analysis, and `git diff
--check` passed.
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Your pull request should address just one issue, without pulling in
other changes.
- [x] Write a pull request description that is detailed enough to understand
what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line
and body.
Note that commits might be squashed by a maintainer on merge.
- [x] Write unit tests that match behavioral changes, where the tests fail
if the changes to the runtime are not applied.
This may not always be possible but is a best-practice.
- [x] Run `mvn verify` to make sure basic checks pass.
A more thorough check will be performed on your pull request automatically.
- [x] You have run the integration tests successfully (`mvn -Prun-its
verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file 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]