elharo opened a new pull request, #827:
URL: https://github.com/apache/maven-shade-plugin/pull/827
## Problem
Calling `project.setFile(dependencyReducedPomLocation)` in `ShadeMojo`
changes the project file reference for all subsequent plugins in the build.
This causes plugins like `apache-rat-plugin` and `maven-checkstyle-plugin` to
resolve relative paths against the wrong directory, breaking their behavior.
Specifically, when `dependencyReducedPomLocation` is set to a directory
other than `${basedir}` (e.g., `target/`), `project.getFile()` returns the DRP
path, and plugins relying on `getFile().getParentFile()` for basedir resolution
will resolve paths incorrectly.
This was introduced/changed by MSHADE-321 (commit 6ea8543) which moved the
`createDependencyReducedPom()` call outside of the inner artifact-processing
block.
## 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` after the shade plugin finishes,
preventing side effects on subsequent plugins.
## Integration Test
`MSHADE-434_ratSideEffect`: Configures shade with
`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 #453
--
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]