elharo opened a new pull request, #828:
URL: https://github.com/apache/maven-shade-plugin/pull/828

   ## Problem
   
   When `shadedArtifactAttached=true`, the original (non-shaded) artifact 
remains the main artifact of the project. The POM used for this main artifact 
comes from `project.getFile()`. After `createDependencyReducedPom()` calls 
`project.setFile(dependencyReducedPomLocation)`, `project.getFile()` points to 
the dependency-reduced POM instead of the original `pom.xml`.
   
   This causes `maven-install-plugin` and `maven-deploy-plugin` to use the 
dependency-reduced POM (which has compile dependencies removed) as the 
project's POM. Downstream projects depending on the library lose transitive 
compile dependencies.
   
   Introduced/changed by MSHADE-321 (commit 6ea8543). The issue manifests 
specifically when:
   - `shadedArtifactAttached=true` (so the original artifact is retained)
   - `createDependencyReducedPom=true` (default)
   - Compile dependencies exist that get shaded and removed from the DRP
   
   ## Fix
   
   Save `project.getFile()` before calling `createDependencyReducedPom()` and 
restore it afterward in `ShadeMojo.execute()`. This ensures `project.getFile()` 
continues to point to the original `pom.xml`, so install/deploy use the correct 
POM with all compile dependencies.
   
   ## Integration Test
   
   `MSHADE-419_attachedDepPom`: Configures shade with 
`shadedArtifactAttached=true` and `dependencyReducedPomLocation` in `target/`, 
then verifies via `maven-help-plugin:evaluate` that `${project.file}` still 
points to the original `pom.xml` after shading.
   
   - Without fix: test fails (project.file is `dependency-reduced-pom.xml`)
   - With fix: test passes (project.file is `pom.xml`)
   
   All 72 unit tests pass.
   
   Fixes #711


-- 
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]

Reply via email to