javaspring-bootgradlegroovyjava-24

Spring Boot 3.4.4 says your build is currently configured to use incompatible Java 24 and Gradle 8.13. Cannot sync the project


I just initialized a Spring Boot 3.4.4 project, with Gradle - Groovy, Language - Java 24.

spring boot 3.4.4 with java 24 and gradle doesn't build says it's incompatible with java 24

But it says Your build is currently configured to use incompatible Java 24 and Gradle 8.13. Cannot sync the project.

Here is the build.gradle:

plugins {
  id 'java'
  id 'org.springframework.boot' version '3.4.4'
  id 'io.spring.dependency-management' version '1.1.7'
}

group = 'com.mua'
version = '0.0.1-SNAPSHOT'

java {
  toolchain {
    languageVersion = JavaLanguageVersion.of(24)
  }
}

repositories {
  mavenCentral()
}

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
  testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
  useJUnitPlatform()
}

And here is the /gradle/wrapper/gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

I can easily downgrade to java 23, or 22. But I want to know why is this configuration listed on that site? And most importantly, how can I make it work?


Solution

  • Gradle 8.13 do not support Java 24.
    See Compatibility matrix

    The next version will support Java 24.
    See: https://docs.gradle.org/8.14-rc-1/release-notes.html
    Release: https://github.com/gradle/gradle-distributions/releases/tag/v8.14.0-RC1