Hi, I've been having issues upgrading junit to ver...
# community-support
l
Hi, I've been having issues upgrading junit to version 5.12.0. After some googling found this saying that you should have a explicit dependency to
junit-platform-launcher
. That guide also points to the Gradle 8 upgrade guide, and it says to fix it you should have the following in your dependencies:
Copy code
dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
I was surprised to see that it worked as I'm not sure how Gradle resolves the version for the
junit-platform-launcher
. I thought you needed a platform dependency to leave versions out. How is the version resolve in that case? And is it actually a good practice?
v
The jupiter dependency brings in the JUnit BOM / platform which defines the version.
l
Oh ok. And is the BOM/platform meant to work across configuration types?
v
Do you mean because of
implementation
vs.
runtimeOnly
?
l
Yes
v
runtimeClasspath
extends from
implementation
and
runtimeOnly
.
runtimeClasspath
is the resolvable configuration that is resolved. So there the platform is present and thus effective.
If you would create a resolvable configuration that extends from
runtimeOnly
but not from
implementation
, resolution would fail.
l
Beautiful. Thanks for the clarification!
👌 1