Listing available toolchains
authorOleksandr Gavenko <gavenkoa@gmail.com>
Tue, 10 Jan 2023 00:05:14 +0200
changeset 2552 32fc3dd882bb
parent 2551 d22668f02ee6
child 2553 11f741239f16
Listing available toolchains
gradle.rst
--- a/gradle.rst	Mon Jan 09 22:25:51 2023 +0200
+++ b/gradle.rst	Tue Jan 10 00:05:14 2023 +0200
@@ -204,10 +204,33 @@
 Listing available toolchains
 ============================
 
-::
+Toolchains are introduced in Gradle 6.7.
+
+Requiring a toolchain for the build::
+
+  java {
+      toolchain {
+          languageVersion.set(JavaLanguageVersion.of(11))
+      }
+  }
+
+Altering toolchain for a specific task (derived from ``java`` plugin)::
+
+  tasks.register<Test>("compatibilityTest") {
+      javaLauncher.set(javaToolchains.launcherFor {
+          languageVersion.set(JavaLanguageVersion.of(17))
+      })
+  }
+
+List of available toolchains::
 
   gradle -q javaToolchains
 
+https://maven.apache.org/guides/mini/guide-using-toolchains.html
+  Guide to Using Toolchains.
+https://blog.gradle.org/java-toolchains
+   Introducing Java toolchains.
+
 Running completely isolated build
 =================================