Skip to content

Propagate updated dependency management model to child modules#7312

Draft
steve-aom-elliott wants to merge 2 commits intomainfrom
fix/propagate-managed-dep-model-to-child-modules
Draft

Propagate updated dependency management model to child modules#7312
steve-aom-elliott wants to merge 2 commits intomainfrom
fix/propagate-managed-dep-model-to-child-modules

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

@steve-aom-elliott steve-aom-elliott commented Apr 7, 2026

Summary

  • When ChangeManagedDependencyGroupIdAndArtifactId changes a parent POM's managed dependency coordinates, child modules now get their resolved model updated even though their XML doesn't change
  • UpdateMavenModel stores resolved module results in the execution context so they can be applied to child documents when visited
  • When a child module's dependency resolution fails during parent model update (due to temporarily inconsistent coordinates), the child's resolved POM model is preserved before rethrowing

Test plan

  • ChangeManagedDependencyGroupIdAndArtifactIdTest.childModuleSeesUpdatedManagedDependencyFromParent — multi-module project where parent managed dep changes, child has unversioned dependency on old coordinates, verifies child model is updated
  • ChangeDependencyGroupIdAndArtifactIdTest.childModuleWithUnversionedDependencyOnParentManagedDep — realistic scenario where both dependency and managed dependency are changed together
  • Full rewrite-maven test suite (1287 tests) passes with no regressions

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Apr 7, 2026
@steve-aom-elliott steve-aom-elliott force-pushed the fix/propagate-managed-dep-model-to-child-modules branch from 7c6970e to 4445f66 Compare April 7, 2026 21:42
When ChangeManagedDependencyGroupIdAndArtifactId changes a parent POM's
managed dependency coordinates, child modules that inherit from it need
their resolved model updated even though their XML doesn't change.

UpdateMavenModel now stores resolved module results in the execution
context via UPDATED_MODULES_KEY. ChangeManagedDependencyGroupIdAndArtifactId
picks these up in visitDocument and applies them to child modules before
visiting their tags.

When a child module's dependency resolution fails during the parent's
model update (e.g., the child has an unversioned dependency on the old
coordinates that no longer have a managed version), the child's resolved
POM model is stored before rethrowing so the model updates are still
available for pickup.
@steve-aom-elliott steve-aom-elliott force-pushed the fix/propagate-managed-dep-model-to-child-modules branch from 4445f66 to a6fd930 Compare April 9, 2026 13:12
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.

1 participant