Build tooling

Gradle Java toolchain

Selects a matching JDK for Java tooling. Static Gradle 9.2.0 example; Gradle execution unverified.

Formal Syntax & Structure

java syntaxjava
languageVersion.set(JavaLanguageVersion.of(21))

Working Example

Example Snippetjava
plugins { `java-library` }java {    toolchain { languageVersion.set(JavaLanguageVersion.of(21)) }}tasks.withType<JavaCompile>().configureEach {    options.release.set(21)    options.encoding = "UTF-8"    options.compilerArgs.add("-proc:none")}tasks.withType<Jar>().configureEach {    isPreserveFileTimestamps = false    isReproducibleFileOrder = true}
Java Reference