If I setup a toolchain the following way, should G...
# gradle
e
If I setup a toolchain the following way, should Gradle automatically download a matching jdk if it can't find one already on the system:
Copy code
jvmToolchain {
      languageVersion.set(JavaLanguageVersion.of(libs.versions.jdk.get()))
      vendor.set(JvmVendorSpec.AZUL)
}
👌 2
no red 1
v
The built-in auto-provisioning only works for Adoptium and AdoptOpenJDK. Since 7.6 you can plug in own toolchain resolvers, for example one that could download Azul Java, but without doing that it will just fail if none is installed.
g
If you add
Copy code
plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version("0.2")
}
To your
settings.gradle
it will work. Gradle distributes an extra plugin that contains a resolver that supports many of the common jdks https://github.com/gradle/foojay-toolchains
e
Thanks! Is there any plan to have built in support for non Adoptium and AdoptOpenJDK in Gradle?
v
I have no idea, but why should there be if there is an API to add any you want and a plugin that lets you do so for the most common ones? 🙂
e
Mostly so I don't have to add it to every project
v
Make a convention plugin that does it. 😄
e
Then I have to apply the convention plugin 😅
I'm being facetious because I actually do have a single convention plugin that I apply to all my projects, but not everyone has that
v
Well, ...
c
you have to add the
jvmToolchain
block to every project anyway. in that step you can also add the plugin
e
That's a good point, but it's still extra steps and maintenance. I'm going to do that, I just think this would be much smoother if it were built in to gradle
c
I also think it should be built in. one less thing that people need to know.