Important Notes on JUnit 5.12.0+ in Gradle

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 tas…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Important Notes on JUnit 5.12.0+ in Gradle." Ryosuke Hasebe | Sciencx - Saturday March 15, 2025, https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/
HARVARD
Ryosuke Hasebe | Sciencx Saturday March 15, 2025 » Important Notes on JUnit 5.12.0+ in Gradle., viewed ,<https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/>
VANCOUVER
Ryosuke Hasebe | Sciencx - » Important Notes on JUnit 5.12.0+ in Gradle. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/
CHICAGO
" » Important Notes on JUnit 5.12.0+ in Gradle." Ryosuke Hasebe | Sciencx - Accessed . https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/
IEEE
" » Important Notes on JUnit 5.12.0+ in Gradle." Ryosuke Hasebe | Sciencx [Online]. Available: https://www.scien.cx/2025/03/15/important-notes-on-junit-5-12-0-in-gradle/. [Accessed: ]
rf:citation
» Important Notes on JUnit 5.12.0+ in Gradle | Ryosuke Hasebe | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.