Skip to content

Allow overriding Maven plugin versions managed by external parents - #8779

Open
angus-guo wants to merge 1 commit into
openrewrite:mainfrom
angus-guo:fix/8775-override-managed-plugin-version
Open

angus-guo wants to merge 1 commit into
openrewrite:mainfrom
angus-guo:fix/8775-override-managed-plugin-version

Conversation

@angus-guo

@angus-guo angus-guo commented Sep 5, 2026 •

Copy link
Copy Markdown

What's changed?

  • Add opt-in overrideManagedVersion to UpgradePluginVersion, used with addVersionIfMissing: true to override versions inherited from an external parent.
  • Compare against the effective managed version, preserving property resolution and avoiding downgrades. Keep local/reactor-managed versions upgraded in place without redundant child versions.
  • Scope each edit to the plugin tag that was checked, so another declaration in a profile cannot be downgraded.
  • Preserve the six-argument constructor and existing defaults; add positive/negative regression tests and update the generated recipe options catalog.

What's your motivation?

Anything in particular you'd like reviewers to focus on?

The new option deliberately leaves the existing trustParent placeholder unchanged. Both overrideManagedVersion and addVersionIfMissing must be enabled to add an external-parent override.

Validation

  • Confirmed the external-parent and external-ancestor regressions fail before the fix. Also reproduced both cross-profile downgrade cases before restricting edits to the target tag.
  • Supplemental JDK 21 validation against public OpenRewrite 8.90.4 dependencies: the complete UpgradePluginVersionTest class has 27 passing tests, 4 existing skips, 0 failures/errors. The affected recipe, original test class, MavenVisitor, Plugin, and ResolvedPom are identical between the base commit and v8.90.4. This is supplemental validation, not a full current-main build.
  • The normal ./gradlew :rewrite-maven:test --tests 'org.openrewrite.maven.UpgradePluginVersionTest*' is blocked during configuration: the build plugin requires Rewrite 8.91.4 from CodeGenome, but no CodeGenome credentials are configured (Username must not be null!). No project dependencies or build configuration were changed to work around this.
  • Updated the catalog options using MavenRecipeMarketplaceGenerator; git diff --check passes.

Ready for review. The normal current-main Gradle build remains blocked locally by unavailable CodeGenome credentials; awaiting repository CI validation.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've run ./gradlew build locally, and committed any resulting changes to recipes.csv
  • I've formatted the lines I changed, without reformatting code I didn't touch

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Sep 5, 2026
@angus-guo
angus-guo marked this pull request as ready for review September 26, 2026 07:40
@angus-guo

Copy link
Copy Markdown
Author

The PR is ready for review. Local current-main Gradle testing is blocked by unavailable CodeGenome credentials; the supplemental JDK 21 results are documented above. No CI checks are currently attached to the head commit. Could a maintainer help check or enable repository CI and review the opt-in external-parent override behavior? I'm happy to address feedback.

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.

UpgradePluginVersion cannot raise a plugin whose version is managed by a parent outside the repository

1 participant