openrewrite / openrewrite/rewrite
UpgradePluginVersion cannot raise a plugin whose version is managed by a parent outside the repository
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What happened
org.openrewrite.maven.UpgradePluginVersion cannot raise a plugin whose version comes from a parent outside the repository, even with addVersionIfMissing: true. ChangePluginVersionVisitor only adds a <version> when hasManagedPluginVersion(...) is false, so a plugin declared without a version under a parent such as org.apache:apache:30 is left on whatever that parent manages.
Concrete case: apache/olingo-odata4 (master). ext/pojogen-maven-plugin/pom.xml declares
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<goalPrefix>pojogen</goalPrefix>
</configuration>
</plugin>
and the root pom inherits from org.apache:apache:30, which manages maven-plugin-plugin 3.6.1. Running
- org.openrewrite.maven.UpgradePluginVersion:
groupId: org.apache.maven.plugins
artifactId: maven-plugin-plugin
newVersion: 3.15.x
addVersionIfMissing: true
(as part of org.openrewrite.java.migrate.UpgradeToJava25, see openrewrite/rewrite-migrate-java#1234) leaves the declaration untouched, and the build on JDK 25 then fails with
Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.1:helpmojo (help-goal) on project pojogen-maven-plugin:
Execution help-goal of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.1:helpmojo failed: Unsupported class file major version 69
The same shape shows up for maven-enforcer-plugin, maven-assembly-plugin and similar plugins that Apache and Spring parent poms manage at versions that cannot load on a current JDK.
What would help
Honouring a remote pluginManagement entry is the right default, but a JDK migration needs a way past it. UpgradeDependencyVersion already offers overrideManagedVersion for the dependency side; an equivalent on UpgradePluginVersion (or letting addVersionIfMissing add a local <version> when the managed version is older than the requested one) would let the Java migration recipes pin the plugin in the child pom, which is what a developer does by hand.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ChangePluginVersionVisitor and compare its managed-version handling with UpgradeDependencyVersion's overrideManagedVersion behavior. Trace the UpgradePluginVersion entry point and existing tests, if present, then verify that a plugin managed by a remote parent can be locally pinned to the requested version without changing the default managed-version behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100