Update Maven Java project properties

Apache 2.0

The Java version is determined by several project properties, including:

  • java.version
  • jdk.version
  • javaVersion
  • jdkVersion
  • maven.compiler.source
  • maven.compiler.target
  • maven.compiler.release
  • maven.compiler.testSource
  • maven.compiler.testTarget
  • maven.compiler.testRelease
  • release.version

Properties of any other name are updated too when the maven-compiler-plugin source, target, release, testSource, testTarget or testRelease configuration of this pom, or of a pom it inherits from, resolves to them. A property whose value is only a reference to another property, such as <maven.compiler.release>${custom.release}</maven.compiler.release>, has the referenced property updated instead, so that anything else using it stays in sync. Each property is updated in the pom of the project that defines it, or overridden in the topmost pom of the project when it is inherited from outside of it.

If none of these properties are in use and the maven compiler plugin is not otherwise configured, adds the maven.compiler.release property.

org.openrewrite.maven.UpdateMavenProjectPropertyJavaVersion

Required

The Java version to upgrade to.

mod run . --recipe=org.openrewrite.maven.UpdateMavenProjectPropertyJavaVersion \ -P version=11

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.