Has minimum Java version

Apache 2.0

Finds source files when the oldest Java version in use meets the supplied minimum version. Java version is attributed per source set (for example src/main/java and src/test/java), so the oldest Java version in use is the lowest version across every source set of every subproject in a repository. For example, the main source set of a project may use Java 8 while its test source set uses Java 17; in that case the oldest Java version in use is Java 8. When the minimum is met, the source files at that oldest Java version are found, along with Gradle build scripts and every non-Java source file (such as pom.xml), which have no Java version of their own.

org.openrewrite.java.search.HasMinimumJavaVersion

Required

A minimum version number or a node-style semver selector. Plain values like 17 or 17.0.1 match that version or higher. To match an exact version, use HasJavaVersion instead.

Optional

checkTargetCompatibilityBoolean

The source and target compatibility versions can be different. This option allows you to check against the target compatibility version instead of the source compatibility version.

mod run . --recipe=org.openrewrite.java.search.HasMinimumJavaVersion \ -P version=17

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