DEV Community

Ryosuke Hasebe
Ryosuke Hasebe

Posted on

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")
Enter fullscreen mode Exit fullscreen mode

(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

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay