jvmTargetValidationMode

Controls JVM target validation mode between this task and the Java compilation task from Gradle for the same source set.

Using the same JVM targets ensures that the produced JAR file contains class files of the same JVM bytecode version, which is important to avoid compatibility issues for users of your code.

The Gradle Java compilation task org.gradle.api.tasks.compile.JavaCompile.targetCompatibility controls the value of the org.gradle.jvm.version attribute which itself controls the produced artifact's minimum supported JVM version via Gradle Module Metadata. This allows Gradle to check the compatibility of dependencies at dependency resolution time.

To avoid problems with different targets, we advise using the JVM Toolchain feature.

The default value for builds with Gradle <8.0 is JvmTargetValidationMode.WARNING, while for builds with Gradle 8.0+ it is JvmTargetValidationMode.ERROR.

Since

1.9.0