Skip to content

Upgrade explicit Java versions in pom.xml files that have no Maven model - #1252

Merged
jkschneider merged 2 commits into
java25/bnd-execution-environmentfrom
java25/alternate-maven-java-version
Oct 3, 2026
Merged

jkschneider merged 2 commits into
java25/bnd-execution-environmentfrom
java25/alternate-maven-java-version

Conversation

@jkschneider

Copy link
Copy Markdown
Member

A repository built with Gradle can also carry a pom.xml (spring-petclinic does). The LST parses it as plain XML with no MavenResolutionResult, so UpdateMavenProjectPropertyJavaVersion never sees it: after the migration the Gradle build targets 25 while the Maven build still says 17 and cannot compile sources that use Java 25 APIs. New UpgradeUnmodeledMavenJavaVersion, added to UpgradeJavaVersion, raises explicit numeric java.version and maven.compiler.{release,source,target} properties and maven-compiler-plugin release/source/target settings below the target in a pom.xml that has no Maven marker. Property references and compiler plugins with a custom groupId are left alone (second commit).

Found by a team of coding agents reviewing a Moderne run of org.openrewrite.java.migrate.UpgradeToJava25 over eight open-source repositories (run 20261003103223-WtyA8). The issue is alternate-maven-java-version in the run's io.moderne.RecipeIssues data table, and the fix was discussed and reviewed on the run's message board. A row from the table, as a generalized example:

The Gradle migration leaves the alternate Maven build targeting Java 17 although migrated sources require Java 25. (spring-projects/spring-petclinic, pom.xml)

Before:

<project><properties><java.version>17</java.version></properties></project>

What the recipe produced:

<project><properties><java.version>17</java.version></properties></project>

Expected:

<project><properties><java.version>25</java.version></properties></project>

Stacked on #1251 (3 of 9); merge that one first.

@jkschneider
jkschneider force-pushed the java25/alternate-maven-java-version branch from 3b963b8 to ac53042 Compare October 3, 2026 15:51
@jkschneider
jkschneider merged commit a68bd7d into main Oct 3, 2026
1 check passed
@jkschneider
jkschneider deleted the java25/alternate-maven-java-version branch October 3, 2026 16:20
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