From cd041b6bbdf6925b88e044738af451a880e3dc51 Mon Sep 17 00:00:00 2001 From: Saeed Rezaee Date: Fri, 21 Apr 2023 14:41:48 +0200 Subject: [PATCH] Fix Kotlin compiler versions mismatch warning Add java toolchain to use Java 11. Signed-off-by: Saeed Rezaee --- build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 56287a5..c031c50 100644 --- a/build.gradle +++ b/build.gradle @@ -50,6 +50,13 @@ allprojects { } } } + + java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + vendor = JvmVendorSpec.ADOPTOPENJDK + } + } } project(':ddi-consumer') { @@ -116,7 +123,7 @@ project(':virtual-device'){ mainClassName = 'org.eclipse.hara.ddiclient.virtualdevice.MainKt' - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] } } @@ -237,7 +244,7 @@ test.finalizedBy stopHawkbitServer group 'org.eclipse.hara.hara-ddiclient' version app_version -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"] }