Use JDK toolchains to explicitly use JDK 17

Explicitly mark that we want version 17 of the JDK as the compiler. Previously
we implicitly relied on Gradle getting this right. This means devs and
CI will all use the same JDK explicitly rather than implicitly.

Pin the target JDK version in build.gradle.kts, this should apply to all
targets (including Kotlin) to version 1.8 to maintain compatibility with
older devices
This commit is contained in:
David Fairbrother 2023-03-05 16:00:45 +00:00 committed by Niels van Velzen
parent 45e7e6456c
commit 4bb2158cc0
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
plugins {
alias(libs.plugins.detekt)
java
}
buildscript {
@ -9,6 +10,12 @@ buildscript {
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of("17"))
}
}
subprojects {
// Configure linting
apply<io.gitlab.arturbosch.detekt.DetektPlugin>()

View File

@ -2,6 +2,12 @@ plugins {
`kotlin-dsl`
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of("17"))
}
}
repositories {
mavenCentral()
}