Does the kotest IDEA plugin not take into account ...
# kotest
p
Does the kotest IDEA plugin not take into account the test runtime classpath? We have
logback-classic
on the
runtimeOnly
and
testRuntimeOnly
gradle dependency scopes, however when running tests via the kotest plugin we get an error about no Slf4J impl on the classpath.
s
Can you make an easy reproducer so I can fix the plugin
👍 1
p
In trying to make an easy reproducer for this I've discovered the cause seems to be related to a library clash on the classpath that IntelliJ generates for the run-configuration (it also occurs when running tests via the JUnit runner rather than Gradle) The following dependencies exhibit this:
Copy code
dependencies {
    implementation("io.github.oshai:kotlin-logging:7.0.0") // has no direct dependency on slf4j
    implementation("io.ktor:ktor-io:2.2.2") // transitively pulls in slf4j 1.7.36
    runtimeOnly("ch.qos.logback:logback-classic:1.5.6") // depends on slf4j 2.0.13
    testImplementation("io.kotest:kotest-runner-junit5:5.9.1")
}
It seems that Gradle, when resolving the runtime classpath (and test runtime) will include only
slf4j-api:2.0.13
however the IntelliJ module classpath (and resulting invocation) will include both
slf4j-api:1.7.36
and
slf4j-api:2.0.13
. So with this, I'm assuming this is not something that is truly a bug in the kotest-intellij-plugin and there's not a lot you can do about it. We can include a compile-time dependency explicitly on
slf4j-api:2.0.13
as a workaround.
Happy to wrap the above dependencies into a simple reproducer for you still if you want but I'm not sure it will help on this.
s
Ok makes sense thanks for the follow up