diff --git a/build.gradle.kts b/build.gradle.kts index eae31b12..0cc6d6de 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,8 +12,10 @@ java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 - toolchain { - languageVersion.set(JavaLanguageVersion.of(21)) + if (!JavaVersion.current().isCompatibleWith(targetCompatibility)) { + toolchain { + languageVersion.set(JavaLanguageVersion.of(targetCompatibility.majorVersion)) + } } }