File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,23 @@ plugins {
55 id(" com.diffplug.spotless" ) version " 6.25.0"
66}
77
8- if (! JavaVersion .current().isCompatibleWith( JavaVersion . VERSION_17 )) {
8+ if (! hasLauncherForJavaVersion( 17 )) {
99 throw GradleException (
10- " JDK 17 or higher is required to build. " +
11- " One option is to download it from https://adoptium.net/. If you believe you already " +
12- " have it, please check that the JAVA_HOME environment variable is pointing at the " +
13- " JDK 17 installation." ,
10+ " JDK 17 is required to build and gradle was unable to detect it on the system. " +
11+ " Please install it and see https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection " +
12+ " for details on how gradle detects java toolchains."
1413 )
1514}
1615
16+ fun hasLauncherForJavaVersion (version : Int ): Boolean {
17+ return try {
18+ javaToolchains.launcherFor { languageVersion = JavaLanguageVersion .of(version) }.get()
19+ true
20+ } catch (e: Exception ) {
21+ false
22+ }
23+ }
24+
1725spotless {
1826 kotlinGradle {
1927 ktlint().editorConfigOverride(mapOf (
You can’t perform that action at this time.
0 commit comments