Note
Require Gradle version 7.6 and above!
In Gradle version 7.6 and above, Gradle provides a way to define Java toolchain auto-provisioning logic in plugins.
Another toolchain resolver plugins use middleware to get endpoint download URL.
That architecture has security issues, such as easily change the endpoint URL without consumer notices.
No need to update plugin just change the middleware API.
Then, this plugin uses the HARD CORDING endpoint URL from official site. Consumer easily check that endpoint URL in this repository files and the only way to modify URL is plugin version change.
| Azul Zulu | |
|---|---|
| JDK 8 | ✅ |
| JDK 11 | ✅ |
| JDK 17 | ✅ |
| JDK 21 | ✅ |
| JDK 25 | ✅ |
| JDK | Official site | License |
|---|---|---|
| Azul Zulu | site | license |
Another JDKs next release version will be treat.
in settings.gradle.kts
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal() // <- add this
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal() // <- add this
}
}pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
// Add this `plugins` in `settings.gradle.kts`
plugins {
id("io.github.jaehwa-noh.resolve-toolchain-plugin-presetting").version("1.0.0-alpha01")
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}done.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
// Add this `plugins` and `toolchainManagement` in `settings.gradle.kts`
plugins {
id("io.github.jaehwa-noh.resolve-toolchain-plugin").version("1.0.0-alpha01")
}
toolchainManagement {
jvm {
javaRepositories {
repository("resolveToolchainPlugin") {
resolverClass.set(
starlightlab.jaehwa.resolve_toolchain_plugin.JavaToolchainResolverImplementation::class.java
)
}
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}done.
in module's build.gradle.kts
kotlin {
compilerOptions {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
}or
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}kotlin {
compilerOptions {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.IBM
// You can set JDK Vendor but this plugin only can download from `Supported JDK section` vendor.
// Otherwise, Azul(Default) JDK will be downloaded
// So that this request downloads Azul JDK 21.
}
}
}Open to contribute to anyone, fork and create a PR.