Skip to content

Fix UpdateMavenModel using stale projectPoms for child module resolution#7310

Merged
timtebeek merged 1 commit intomainfrom
tim/fix-maven-newer-version
Apr 7, 2026
Merged

Fix UpdateMavenModel using stale projectPoms for child module resolution#7310
timtebeek merged 1 commit intomainfrom
tim/fix-maven-newer-version

Conversation

@timtebeek
Copy link
Copy Markdown
Member

Summary

  • Fixes ChangeParentPom incorrectly updates child module after update #7307
  • When UpdateMavenModel re-resolved a POM after XML changes (e.g. a parent version bump by ChangeParentPom), the projectPoms map was built from the original marker hierarchy and still contained the old requested Pom
  • Child modules resolved recursively would look up the stale root Pom and inherit dependency management from the old grandparent, causing subsequent recipes to incorrectly add explicit versions for managed dependencies
  • The fix updates the projectPoms map with the current requested Pom before passing it to updateResult()

Test plan

  • Extended existing submoduleParentModelDependencyManagementUpdated test to verify the child's own resolved dependency management and the root's module list both reflect the new grandparent
  • Confirmed test fails before fix, passes after
  • Full ChangeParentPomTest suite passes
  • AddDependencyTest and RemoveRedundantDependencyVersionsTest pass

…ion (#7307)

When UpdateMavenModel re-resolved a POM after XML changes (e.g. parent
version bump), the projectPoms map was built from the original marker
hierarchy and still contained the old requested Pom. Child modules
resolved recursively would therefore look up the stale root Pom and
inherit dependency management from the old grandparent.

Update the projectPoms map with the current requested Pom before passing
it to updateResult(), so recursive child resolution sees the updated
parent reference.
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Apr 7, 2026
@timtebeek timtebeek merged commit 5a79346 into main Apr 7, 2026
1 check passed
@timtebeek timtebeek deleted the tim/fix-maven-newer-version branch April 7, 2026 18:33
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

ChangeParentPom incorrectly updates child module after update

3 participants