Skip to content

Commit 2998e84

Browse files
BenchmarkingBuffalomhalbritter
authored andcommitted
Fail fast with explicit error message for incompatible JDK version
See gh-46818 Signed-off-by: BenchmarkingBuffalo <46448799+BenchmarkingBuffalo@users.noreply.github.com>
1 parent 024bb72 commit 2998e84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

settings.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ 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+
}
5055
develocity {
5156
buildScan {
5257
def toolchainVersion = settings.gradle.rootProject.findProperty('toolchainVersion')

0 commit comments

Comments
 (0)