Keep a child module's dependency version when changing a parent pom - #8602
Draft
timtebeek wants to merge 2 commits into
Draft
Keep a child module's dependency version when changing a parent pom#8602timtebeek wants to merge 2 commits into
timtebeek wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;withRestoredManagementnow patches that requested dependency management before descendants resolve against it, which also clears the spuriousNo version providedmarker 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 earlierChangeParentPomstripped as redundant is invisible to it — that module now writes its own version back inpinVersionsDroppedByChangedAncestor.Tests cover both scenarios from the issue and assert the resolved model, not just the emitted text.