arturobernalg opened a new pull request, #881: URL: https://github.com/apache/maven-shade-plugin/pull/881
When a dependency is declared with `<type>test-jar</type>` and gets shaded into the uber jar, it is not removed from the generated `dependency-reduced-pom.xml` the way a normal shaded dependency would be. The POM declares no classifier for a test-jar dependency, but Maven resolves it to classifier `tests` once it becomes an `Artifact` (`DefaultArtifact` falls back to the artifact handler's classifier when none is given). `ShadeMojo` built the id used to decide what gets removed straight from the `Dependency`'s raw (empty) classifier, so it never matched the id of the resolved, shaded artifact, and the dependency survived in the reduced POM. The fix resolves the dependency's effective classifier through the already-injected `ArtifactHandlerManager` before building the comparison id, the same way Maven derives it for the resolved artifact. Added a unit test for the id-building logic plus an integration test under `src/it/projects/dep-reduced-pom-test-jar` that shades a test-jar dependency and asserts it is gone from `dependency-reduced-pom.xml`. Verified the integration test fails on master without the fix and passes with it. Full unit test suite and `mvn -Prun-its verify` both pass, and checkstyle/RAT are clean. Fixes #669 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) - [x] 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]
