gnodet opened a new pull request, #13196: URL: https://github.com/apache/maven/pull/13196
## Summary Fixes #13191 — `maven-shade-plugin` generates `dependency-reduced-pom.xml` with `<relativePath>pom.xml</relativePath>` copied from the original POM. Maven 4's stricter parent POM resolution resolves this path to the project's own `pom.xml`, finds it has the same G:A as the child (not the declared parent), and raises a `[FATAL]` error that breaks the build. ## Root Cause `mismatchRelativePathAndGA()` in `DefaultModelBuilder` correctly detects that an explicit `<relativePath>` doesn't resolve to the declared parent — but it doesn't distinguish between: 1. A **genuine config error** (user wrote a wrong `relativePath` pointing to a completely different project) 2. A **self-referential artifact** from a generated/transformed POM (shade plugin copies `<relativePath>` from the original POM, which ends up pointing to the child artifact itself) Maven 3 was lenient about this case; Maven 4 changed it to FATAL, which broke projects using maven-shade-plugin. ## Fix In `mismatchRelativePathAndGA()`, detect when the locally-resolved file's G:A matches the **child's own G:A** (a self-reference). In that case: - Downgrade from `[FATAL]` to `[WARNING]` - Emit an informative message pointing at the generating tool as the source of the incorrect `<relativePath>` - Fall back to repository resolution for the parent (same as Maven 3 behavior) Genuine mismatches (explicit `<relativePath>` pointing to a genuinely different wrong artifact) remain `[FATAL]`. The fix covers both call sites of `mismatchRelativePathAndGA()`: 1. `doReadFileModel()` — parent coordinate completion when G/A/V are partially missing 2. `ParentResolutionFrame.advance()` — normal parent resolution (the shade plugin path) ## Test Added `testSelfReferentialRelativePathInGeneratedPomIsWarning` to `ParentCycleDetectionTest`: creates a `dependency-reduced-pom.xml` with `<relativePath>pom.xml</relativePath>` alongside the project's actual `pom.xml`, builds it with `BUILD_PROJECT`, and asserts that the problem is a WARNING (not FATAL) about the self-referential path. _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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]
