Skip to content

Commit afc24ae

Browse files
committed
Polish "Fail fast with explicit error message for incompatible JDK version"
See spring-projectsgh-46818
1 parent 2998e84 commit afc24ae

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

buildSrc/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ plugins {
2222
id "org.jetbrains.dokka" version "2.1.0"
2323
}
2424

25+
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_24)) {
26+
throw new GradleException("This build requires Java 24 or newer to run, but you are currently using Java ${JavaVersion.current()}")
27+
}
28+
2529
repositories {
2630
mavenCentral()
2731
gradlePluginPortal()

settings.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ rootProject.name="spring-boot-build"
4747
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
4848

4949
settings.gradle.projectsLoaded {
50-
ensureCompatibleJavaVersion -> {
51-
if (!JavaVersion.current().isCompatibleWith(JavaVersion.toVersion(24))) {
52-
throw new GradleException("Java 24 or newer is needed to compile. Java version used is ${JavaVersion.current().toString()}.")
53-
}
54-
}
5550
develocity {
5651
buildScan {
5752
def toolchainVersion = settings.gradle.rootProject.findProperty('toolchainVersion')

0 commit comments

Comments
 (0)