Skip to content

Keep a child module's dependency version when changing a parent pom - #8602

Draft
timtebeek wants to merge 2 commits into
mainfrom
tim/issue-8595
Draft

Keep a child module's dependency version when changing a parent pom#8602
timtebeek wants to merge 2 commits into
mainfrom
tim/issue-8595

Conversation

@timtebeek

@timtebeek timtebeek commented Aug 21, 2026

Copy link
Copy Markdown
Member

Two separate defects were at play. First, descendants are re-parented onto the marker the scan phase built, which re-resolves the changed pom with only its <parent> swapped and so omits the dependency management the edit phase is about to restore; withRestoredManagement now patches that requested dependency management before descendants resolve against it, which also clears the spurious No version provided marker an existing test had codified. Second, an aggregator can only restore management for the modules it can see, and its snapshot of them predates any edit made earlier in the same run (the scan phase for the whole recipe list runs at the start of a cycle), so a module whose version an earlier ChangeParentPom stripped as redundant is invisible to it — that module now writes its own version back in pinVersionsDroppedByChangedAncestor.

Tests cover both scenarios from the issue and assert the resolved model, not just the emitted text.

Two defects let a module end up with a dependency that resolves to no
version at all when its aggregator's parent changes.

A descendant is re-parented onto the marker the scan phase built, which
re-resolves the changed pom with only its <parent> swapped, so it does
not hold the dependency management the edit phase is about to restore.
`withRestoredManagement` now patches that requested dependency
management before descendants resolve against it.

The aggregator can only restore management for the modules it can see,
and its snapshot of them predates any edit made earlier in the same run
- the scan phase for the whole recipe list runs at the start of a cycle.
A module whose version an earlier `ChangeParentPom` stripped as
redundant is therefore invisible to it, so the module now writes its own
version back in `pinVersionsDroppedByChangedAncestor`.

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Sequential ChangeParentPom Recipe creates orphaned dependencies

1 participant