This Gradle project:

dependencies {
    testImplementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.6"))
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.test {
    useJUnitPlatform()
}

works in the current stable Gradle version (8.14.2), but fails in Gradle 9.0.0-rc-1 with:

Execution failed for task ':test'.
> Could not start Gradle Test Executor 1: Failed to load JUnit Platform.  Please ensure that the JUnit Platform is available on the test runtime classpath.

According to Gradle developers, the behaviour of Gradle 9 is as expected, due to a removal of deprecated functionality (of Gradle guessing which version of junit-platform-launcher to add to classpath): https://github.com/gradle/gradle/issues/33950#issuecomment-2989035089

There are people writing that the deprecated functionality caused problems with Spring Boot 3.5.0: https://discuss.gradle.org/t/why-do-gradle-docs-specify-junit-platform-launcher-for-junit-5-tests/46286/8. This seems to confirm the removal in Gradle 9 is a good decision.

So I think the move should be on Spring Boot side, by adding a runtime dependency on junit-platform-launcher to spring-boot-starter-test.

Comment From: philwebb

I don't think we can add the dependency by default because it's likely to break other build systems. We already have some code that adds the dependency if you're using our Gradle plugin.

@pkubowicz can you check you have something like this in your build:

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

If you do, could you share a complete project that reproduces the problem.