This message was deleted.
# community-support
s
This message was deleted.
v
I strongly recommend using JVM Toolchains feature.
You can also turn off auto-provisioning and configure environment variables that are used to find the matching runtime, so should exactly meet what you need.
r
right, i'm trying that. but i can't seem to change any of the properties. e.g. neither
Copy code
kotlin {
    jvmToolchain {
        languageVersion = JavaLanguageVersion.of(17)
        vendor = JvmVendorSpec.JETBRAINS
    }
}
nor
Copy code
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
        vendor = JvmVendorSpec.JETBRAINS
    }
}
worked (referencing https://github.com/gradle/gradle/pull/26014)
I get The value for property 'languageVersion' is final and cannot be changed any further.
v
You use Kotlin DSL and are on a too old Gradle version to use
=
. Either update Gradle or use
.set(...)
r
gradle 8.4. (shouldn't the docs reflect this then? https://docs.gradle.org/current/userguide/toolchains.html) now it gets past the error with set, but seems to have no effect(?), as it still dumps out a warning referencing a different jdk: Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
v
If you are on Gradle 8.4
=
should work. It is even declared stable since Gradle 8.4. If
=
is not working, you are not using Gradle 8.4. Can you show a build
--scan
where it is failing?
r
./gradlew --version gives 8.4, so i am for sure using 8.4 🙂
v
now it gets past the error with set, but seems to have no effect(?), as it still dumps out a warning referencing a different jdk:
Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
Sure it has effect. It first detects all toolchains in some common places. At that path is something, but it is not a valid Java toolchain so you get a warning. After the toolchains are discovered, one that matches your settings is selected if available.
./gradlew --version gives 8.4, so i am for sure using 8.4
Then please share an MCVE where it is failing.
r
yeah i came to the same conclusion. with .set it works. without .set it errors. but i can live with .set, good enough for now
v
I'm still curious, could you share an MCVE where it does not work?
r
i'm not sure why, but i can't repro the "cannot be changed" error anymore. i swear i didn't change gradle version partway through the thread
👌 1