Skip to content

spring-boot-starter-test is missing junit-platform-launcher to work with Gradle 9 #46037

Closed as not planned
@pkubowicz

Description

@pkubowicz

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): gradle/gradle#33950 (comment)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions