This content originally appeared on DEV Community and was authored by Ryosuke Hasebe
TL;DR
When upgrading to JUnit 5.12.0 or later, be sure to add:
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
(The version is omitted under the assumption that you're using a BOM.)
If you don't add this, the test task will fail to execute, so you'll likely notice the issue right away.
Why
If you don't explicitly declare a dependency on junit-platform-launcher
, Gradle will implicitly use its bundled version.
As of Gradle 8.13, the bundled version is 1junit-platform-launcher 1.8.2` (whereas the latest version currently is 1.12.0).
JUnit 5.12 is incompatible with junit-platform-launcher 1.8.2
, which results in test execution failures.
Gradle was aware of such potential issues and, starting with Gradle 8, recommended explicitly specifying junit-platform-launcher
.
See the official Gradle upgrade guide: Gradle 8 Upgrade Guide
Ref
This content originally appeared on DEV Community and was authored by Ryosuke Hasebe

Ryosuke Hasebe | Sciencx (2025-03-15T00:42:42+00:00) Important Notes on JUnit 5.12.0+ in Gradle. Retrieved from https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.