Skip to content

Fix #12074: prevent false parent cycle with shade plugin's dependency-reduced-pom.xml#12079

Merged
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport-12074-to-4.0.x
May 19, 2026
Merged

Fix #12074: prevent false parent cycle with shade plugin's dependency-reduced-pom.xml#12079
gnodet merged 1 commit into
apache:maven-4.0.xfrom
gnodet:backport-12074-to-4.0.x

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 18, 2026

Summary

Backport of #12078 to maven-4.0.x.

  • Fix false parent cycle detection in Maven 4's model builder when a generated POM (e.g., dependency-reduced-pom.xml from shade plugin) has a parent whose default relative path resolves to a POM with a different GA but the same parent reference
  • Move the GA mismatch check before the recursive readAsParentModel() call by reading the file model first, matching the Maven 3 model builder's behavior

Test plan

  • New unit test testNoFalseCycleWhenRelativePathResolvesToWrongPom in ParentCycleDetectionTest
  • All 4 cycle detection tests pass on maven-4.0.x

Fixes #12074

Claude Code on behalf of Guillaume Nodet

…ndency-reduced-pom.xml

In readParentLocally(), the GA mismatch check ran after readAsParentModel()
which recursively resolves the candidate's parent chain. When a generated POM
(e.g., dependency-reduced-pom.xml) sits alongside the project POM and the
default relative path resolves to the wrong POM, the recursive resolution
adds the shared parent's model ID to the chain — triggering a false cycle.

Move the GA check before the recursive call by reading only the file model
first. This matches the behavior of the Maven 3 model builder which checked
GA before recursing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gnodet gnodet force-pushed the backport-12074-to-4.0.x branch from 9dd7603 to a404c0d Compare May 19, 2026 09:06
gnodet added a commit that referenced this pull request May 19, 2026
gnodet added a commit that referenced this pull request May 19, 2026
@gnodet gnodet added this to the 4.0.0-rc-6 milestone May 19, 2026
@gnodet gnodet merged commit 1b53468 into apache:maven-4.0.x May 19, 2026
22 checks passed
@github-actions
Copy link
Copy Markdown

@gnodet Please assign appropriate label to PR according to the type of change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants