efegokdemir opened a new pull request, #865: URL: https://github.com/apache/maven-shade-plugin/pull/865
Fixes #864 ## What Keep Maven 4's installed consumer POM dependency-reduced when the Shade plugin removes dependencies from the shaded artifact. ## Why Maven 4 attaches a lazy consumer POM before the Shade goal runs. Updating `MavenProject.file` changes the build POM, while the consumer POM continues to be generated from the original project POM, so downstream users resolve dependencies already included in the shaded JAR. ## How After writing the dependency-reduced POM, the plugin materializes Maven 4's existing `pom:consumer` artifact and replaces its generated file with the reduced POM. It does not add a duplicate artifact. The Maven 3 path remains unchanged. ## Testing - Added an install integration test adapted from the reproducer linked in #864. It checks the installed consumer POM and build POM, and verifies that the original project POM remains unchanged. - Maven 3.10.0 / JDK 17: `mvn -B -Prun-its -Dinvoker.test=dep-reduced-pom-864 verify` — passed (72 unit tests and the targeted IT). - Maven 4.0.0-rc-7 / JDK 17: `/tmp/maven-4-rc7/bin/mvn -B -Prun-its -Dinvoker.test=dep-reduced-pom-864 verify` — passed (72 unit tests and the targeted IT). - Fail-before evidence: the new IT failed on the unmodified implementation because the installed consumer POM still declared all four shaded dependencies; it passes after this change. - Checkstyle and Spotless ran as part of both verification commands; `git diff --check` passed. ## Compatibility Maven 3 behavior is unchanged. Maven 4 keeps the dependency-reduced POM as its build POM and now uses it for the consumer POM as well. AI assistance: OpenAI Codex (GPT-6) assisted with investigation, implementation, and test drafting. The commit includes the ASF `Generated-by` provenance trailer. ## Checklist - [x] I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004 - [ ] I hereby declare that I have filed an Apache Individual Contributor License Agreement -- 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]
