Skip to content

UpgradePluginVersion: skip adding version when managed by pluginManagement#6828

Open
timtebeek wants to merge 1 commit intomainfrom
fix/upgrade-plugin-version-skip-managed
Open

UpgradePluginVersion: skip adding version when managed by pluginManagement#6828
timtebeek wants to merge 1 commit intomainfrom
fix/upgrade-plugin-version-skip-managed

Conversation

@timtebeek
Copy link
Member

@timtebeek timtebeek commented Feb 26, 2026

Summary

Test plan

  • Added shouldNotAddVersionWhenManagedByParent test verifying no <version> is added to a child module when the parent's <pluginManagement> manages the plugin version
  • Verified the parent's managed version is still upgraded
  • All existing UpgradePluginVersionTest tests pass
  • Java8toJava11Test in rewrite-migrate-java passes (uses addVersionIfMissing: true for maven-compiler-plugin)

…nagement

When `addVersionIfMissing` is true, `UpgradePluginVersion` now checks whether
the plugin already has a version managed via `<pluginManagement>` (local or
inherited from a parent POM) before adding an explicit `<version>` tag. This
prevents unwanted version additions in child modules that inherit their plugin
version from a parent.

Fixes openrewrite/rewrite-migrate-java#992
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Feb 26, 2026
@timtebeek timtebeek added bug Something isn't working recipe Requested Recipe maven labels Feb 26, 2026
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working maven recipe Requested Recipe

Projects

Status: Ready to Review

Development

Successfully merging this pull request may close these issues.

After upgrading rewrite-migrate-java from 3.27.1 to 3.28.0 openrewrite keeps adding version element even if the one is managed in the parent

1 participant