Raise the build plugins and Lombok processor path that Java 25 needs, and keep Gradle 9 builds configuring - #1234
Open
jkschneider wants to merge 4 commits into
Open
Raise the build plugins and Lombok processor path that Java 25 needs, and keep Gradle 9 builds configuring#1234jkschneider wants to merge 4 commits into
jkschneider wants to merge 4 commits into
Conversation
…on tests A module whose compiler level lives in the parent's pluginManagement, either literally or through a custom property, must be raised with the parent.
maven-enforcer-plugin 1.x, maven-assembly-plugin 2.x and maven-plugin-plugin 3.6 fail at startup on JDK 25, and a checkstyle pinned on maven-checkstyle-plugin must parse the pattern-matching switch the Java 21 migration writes.
…the Gradle 9 wrapper Gradle 9 removed the JavaPluginConvention, so a build that assigned sourceCompatibility on the project stopped configuring once the wrapper moved.
JDK 23 stopped running annotation processors found on the classpath, so AddAnnotationProcessor writes the lombok path into the parent's pluginManagement. A per-module precondition never marked that parent pom, so multi-module builds kept compiling without Lombok on JDK 25.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What went wrong
UpgradeToJava25was applied to ten real Maven and Gradle repositories under Apache, Netflix and Spring Cloud that compiled cleanly on JDK 8/17 beforehand. Afterwards none of them built on JDK 25. The failures fall into three groups:maven-enforcer-plugin1.1.1/1.4 dies withExceptionInInitializerErrorbefore the first module compiles (stanbol, incubator-batchee),maven-assembly-plugin2.6 reportsNo such archiver: 'zip'(sdap-mudrod),maven-plugin-plugin3.6.1 fails withUnsupported class file major version 69(olingo-odata4), and thecheckstyle8.45 that incubator-hugegraph-toolchain pins onmaven-checkstyle-plugincannot parse the pattern-matchingswitchthatUpgradeToJava21writes (unexpected token: results ->). Lombok belongs here as well: JDK 23 stopped running annotation processors found on the classpath, and althoughEnableLombokAnnotationProcessorexists for exactly that, itsModuleHasDependencyprecondition only marks the module that declares Lombok.AddAnnotationProcessorwrites the processor path into the reactor parent'spluginManagement, a pom that precondition never marks, so every multi-module build (rocketmq-schema-registry, incubator-hugegraph-toolchain) compiled without Lombok and failed on the getters andlogfields it should have generated.JavaPluginConvention, so a build that assignssourceCompatibilityon the project (eureka'ssubprojects { sourceCompatibility = 1.8 }) now fails withCould not set unknown property 'sourceCompatibility', even though the recipe had just rewritten that very line to25.<release>${project.build.release.version}</release>in a parent'spluginManagement,<source>1.6</source>in a parent,maven.compiler.sourceproperties) stayed behind while the sources gained switch expressions, pattern-matchinginstanceofandIO.println. Re-running the recipe against the same checkouts raised every one of those declarations, so this could not be reproduced in the recipe itself; the shapes are now pinned down by tests so a regression shows up here first.What changed
UpgradePluginsForJava25raisesmaven-enforcer-pluginto 3.x,maven-assembly-pluginto 3.x,maven-plugin-pluginto 3.15.x andmaven-checkstyle-pluginto 3.6.x, and bumps acom.puppycrawl.tools:checkstylepinned as a plugin dependency to 10.x, the first line whose parser accepts the Java 21 syntax the migration introduces.EnableLombokAnnotationProcessoris gated on a newModuleOrParentHasDependencyprecondition, which marks the modules that depend on Lombok and the in-reactor parent poms they inherit from, soAddAnnotationProcessorreaches the pom it targets.UpgradePluginsForJava25runsorg.openrewrite.gradle.gradle9.UseJavaExtensionBlockright after the wrapper bump, sosourceCompatibility/targetCompatibilityassigned at project level (including insidesubprojects { }/allprojects { }) move into thejava { }block before Gradle 9 rejects them.UpgradeJavaVersionTestgains multi-module cases for a compiler level inherited from the parent'spluginManagement, literally, through a custom property, and through themaven.compiler.*properties with test-source overrides.What is left for the reader
Plugin versions managed by a parent outside the repository. olingo-odata4 declares
maven-plugin-pluginwithout a version and inherits 3.6.1 fromorg.apache:apache:30;UpgradePluginVersionhonours the remotepluginManagementeven withaddVersionIfMissing, so the bump does not land and the build still fails athelpmojo. Filed as UpgradePluginVersion cannot raise a plugin whose version is managed by a parent outside the repository rewrite#8775 rather than worked around here.JAXB in incubator-batchee. Once the enforcer no longer crashes,
jbatchfails onjavax.xml.bind.annotationnot existing;AddJaxbDependenciesWithRuntimedid not add the dependency to that module. That is a Java 11 migration gap unrelated to this change.Non-Java build plugins. incubator-hugegraph-toolchain now compiles its Java modules and stops in
hugegraph-spark-connectoronorg.scala-tools:maven-scala-plugin2.15.2, a long-abandoned Scala plugin with no drop-in successor coordinate.Gradle plugins compiled against removed Gradle APIs. eureka's
com.netflix.nebula.netflixoss11.6.0 needsorg.gradle.util.VersionNumber, and Hystrix's ownbuildSrcplugin referencesorg.gradle.util.ConfigureUtil; both were removed in Gradle 9. Gradle 8.x does not run on JDK 25, so stopping the wrapper short is not an option, and rewriting third-party or in-repo plugin code is beyond a version bump.MigrateToGradle9in rewrite-gradle carries the rest of the script-level migration and can be layered on top; the plugin code has to be updated by hand.Kotlin 1.x modules. spring-cloud-sleuth's
kotlin-maven-plugin1.6.21 throwsIllegalArgumentException: 25when the compiler itself is started on JDK 25. The recipe deliberately does not cross the Kotlin 2.0 boundary, so such modules stay on a JDK 24 toolchain by design; building them with a JDK 25 requires the Kotlin bump first.A newer checkstyle can report new violations. Raising the checkstyle line to one that parses Java 21 also enables checks the old version did not have; rocketmq-schema-registry now fails
UnnecessaryParentheseson untouched code after the plugin moved from 2.17 to 3.6.0. That is a style decision for the project rather than something the migration can settle.Verification against real repositories
Each repository was reset, the recipe applied from a locally built jar, and the project compiled on JDK 25 (
mvn compile/./gradlew testClasses), before and after this change.maven-assembly-plugin:2.6No such archiver: 'zip'maven-assembly-plugin3.8.0)maven-enforcer-plugin:1.1.1ExceptionInInitializerErroron the parentjbatchcompiles;jbatchfails on the missing JAXB dependency described aboveUnnecessaryParentheseson untouched code; with-Dcheckstyle.skip, exit 1 on Lombok-generatedlog, getters and constructors-Dcheckstyle.skip(Lombok now runs); the checkstyle style finding remainscheckstyle8.45unexpected token: results ->hugegraph-client/hugegraph-loadercompile; stops atmaven-scala-plugin:2.15.2inhugegraph-spark-connectormaven-plugin-plugin:3.6.1Unsupported class file major version 69org.apache:apache:30(openrewrite/rewrite#8775)kotlin-maven-plugin:1.6.21IllegalArgumentException: 25sourceCompatibilityunknown property /org.gradle.util.ConfigureUtilunder Gradle 9.1sourceCompatibilityhalf is covered by the new unit test, the plugin code is out of reachmaven-enforcer-plugin:1.4ExceptionInInitializerErroron the parentUpgradeJavaVersionTestandUpgradeToJava25Testpass in full.