Skip to content

Comments

Add maven-compiler-plugin version when missing during Java migration#989

Merged
jkschneider merged 1 commit intomainfrom
jkschneider/java11-migration-fix
Feb 18, 2026
Merged

Add maven-compiler-plugin version when missing during Java migration#989
jkschneider merged 1 commit intomainfrom
jkschneider/java11-migration-fix

Conversation

@jkschneider
Copy link
Member

Summary

  • When maven-compiler-plugin is declared without a <version> tag and uses <source>/<target> configuration, the Java migration recipes convert to <release> but don't add a plugin version. Maven 3.x defaults to plugin version 3.1 which doesn't support <release> (introduced in 3.6), causing build failures.
  • Added addVersionIfMissing: true to the UpgradePluginVersion calls for maven-compiler-plugin in the Java 11, 17, and 25 migration recipes.

Test plan

  • Added compilerPluginVersionAddedWhenMissing test verifying UpgradePluginsForJava11 adds a version to a versionless plugin
  • Added compilerPluginVersionAddedAndReleaseSetForFullMigration integration test verifying the full Java8toJava11 recipe sets both <release>11</release> and a plugin version

When maven-compiler-plugin has no <version> tag and uses <source>/<target>,
the migration converts to <release> but the default plugin version (3.1)
doesn't support it. Set addVersionIfMissing on UpgradePluginVersion so a
compatible version is always present.
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Feb 18, 2026
@jkschneider jkschneider merged commit c17f866 into main Feb 18, 2026
1 check passed
@jkschneider jkschneider deleted the jkschneider/java11-migration-fix branch February 18, 2026 20:14
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant