Title
t

thol01

09/09/2020, 8:42 AM
Hi, I get this error when i run gradlew (gradle version 6.6.1) using io.kotest:kotest-runner-junit5-jvm:4.2.3. But it does work with kotest 4.2.0.RC2.
Running the the test in Intellij (no kotest plugin) works with 4.2.3 of kotest but not with gradle…
l

LeoColman

09/09/2020, 8:47 AM
Interesting
How did you setup your gradle?
t

thol01

09/09/2020, 8:51 AM
plugins {
    id 'org.springframework.boot' version '2.3.3.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'org.jetbrains.kotlin.jvm' version  '1.4.0'
    id "org.jetbrains.kotlin.plugin.allopen" version "1.4.0"
    id 'org.jetbrains.kotlin.plugin.spring' version '1.4.0'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.0'
}

repositories {

    mavenLocal()
    mavenCentral()
    jcenter()

}



version = System.getenv('version') ?: "$project.version"

springBoot {

    mainClassName = 'infotorg.consumer.cnr.AppKt'

}

compileKotlin {

    kotlinOptions {

        freeCompilerArgs = ["-Xjsr305=strict", "-Xopt-in=kotlin.RequiresOptIn"]
        jvmTarget = "11"

    }

}

compileTestKotlin {

    kotlinOptions {

        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "11"

    }

}

test {

    useJUnitPlatform()

}


// This is so we only publish our stubs to artifactory when master is build
tasks.withType(PublishToMavenRepository) {

    onlyIf {
        System.getenv('branchName') == 'master'
    }

}

dependencies {

    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.kafka:spring-kafka'
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive:2.3.3.RELEASE'
    implementation 'org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE'

    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC'
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'

    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.11.2'

    implementation 'com.jayway.jsonpath:json-path:2.4.0'

    implementation 'com.bisnode.response:responsekt:2.0.0'

    testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude module: 'junit-vintage-engine'
        exclude module: 'mockito-core'
    }

    testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.2.4'

    testImplementation 'com.ninja-squad:springmockk:2.0.3'
    testImplementation 'io.mockk:mockk:1.10.0'
    testImplementation 'io.rest-assured:spring-mock-mvc:3.3.0'
    testImplementation 'io.projectreactor:reactor-test'
    testImplementation 'org.springframework.kafka:spring-kafka-test'
    testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9'
    testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'

}
Just tested with kotest 4.2.4 but the same error…
l

LeoColman

09/09/2020, 8:58 AM
Could you try to invalidate and restart? It seems to me that your gradle is not configuring the
junit5-jvm
bit correctly
Also, could you check your gradle version?
t

thol01

09/09/2020, 9:08 AM
Gradlew is 6.6.1 and we have tried it on 3 developer machines and our build server and the all get the same error.
Just did a gradlew -version and got this: ------------------------------------------------------------ Gradle 6.6.1 ------------------------------------------------------------ Build time: 2020-08-25 16:29:12 UTC Revision: f2d1fb54a951d8b11d25748e4711bec8d128d7e3 Kotlin: 1.3.72 Groovy: 2.5.12 Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020 JVM: 11.0.2 (Oracle Corporation 11.0.2+9-LTS) OS: Mac OS X 10.15.6 x86_64
Could it be that it’s using Kotlin 1.3.72?
l

LeoColman

09/09/2020, 9:45 AM
Gradle uses that version, I don't believe that's the issue
It still didn't update
I believe it might be the Java version
Could you try using jdk 8 instead of 11?
t

thol01

09/09/2020, 9:56 AM
One of our lib is build with jdk 11. But I will try to build a version of that lib with jdk 8. I also think it has to do with java version some how.
l

LeoColman

09/09/2020, 10:20 AM
just to eliminate this possibility. Kotest itself is built with JDK 11
t

thol01

09/09/2020, 10:47 AM
Ok. I trying to set our lib to JDK 8 but when i do that and use it from the other project that has kotest it now complains that my lib is still jdk 11…
This is the gradle file for that project:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {

    id("org.jetbrains.kotlin.jvm") version "1.4.0"
    kotlin("plugin.serialization") version "1.4.0-rc"

    // Apply the java-library plugin for API and implementation separation.
    // `java-library`
}

java {

    targetCompatibility = JavaVersion.VERSION_1_8

}


tasks.test {
    useJUnitPlatform()
}

repositories {

    mavenCentral()
    jcenter()
    maven("<https://kotlin.bintray.com/kotlinx>")
}

tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions.jvmTarget = "1.8"
    kotlinOptions.apiVersion = "1.4"
}

tasks.withType<Test> {
    useJUnitPlatform()
}

dependencies {

    implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC")
    implementation(kotlin("reflect"))

    testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.2")

}
This is the error I get when using it:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:compileKotlin’.
Could not resolve all files for configuration ‘:compileClasspath’.
> Could not resolve com.bisnode.response:responsekt:2.0.1-SNAPSHOT. Required by: project : > No matching variant of com.bisnode.response:responsekt:2.0.1-SNAPSHOT:20200828.054422-1 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, as well as attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘jvm’ but: - Variant ‘apiElements’ capability com.bisnode.response:responsekt:2.0.1-SNAPSHOT declares an API of a library, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘jvm’: - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8 - Variant ‘runtimeElements’ capability com.bisnode.response:responsekt:2.0.1-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘jvm’: - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
This is the new gradle for the project with Kotest:
plugins {
    id 'org.springframework.boot' version '2.3.3.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'org.jetbrains.kotlin.jvm' version  '1.4.0'
    id "org.jetbrains.kotlin.plugin.allopen" version "1.4.0"
    id 'org.jetbrains.kotlin.plugin.spring' version '1.4.0'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.0'
}

repositories {

    mavenLocal()
    mavenCentral()
    jcenter()

}

java {

    targetCompatibility = JavaVersion.VERSION_1_8

}



version = System.getenv('version') ?: "$project.version"

springBoot {

    mainClassName = 'infotorg.consumer.cnr.AppKt'

}

compileKotlin {

    kotlinOptions {

        freeCompilerArgs = ["-Xjsr305=strict", "-Xopt-in=kotlin.RequiresOptIn"]
        jvmTarget = "1.8"

    }

}

compileTestKotlin {

    kotlinOptions {

        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "1.8"

    }

}

test {

    useJUnitPlatform()

}


// This is so we only publish our stubs to artifactory when master is build
tasks.withType(PublishToMavenRepository) {

    onlyIf {
        System.getenv('branchName') == 'master'
    }

}

dependencies {

    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.kafka:spring-kafka'
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive:2.3.3.RELEASE'
    implementation 'org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE'

    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC'
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'

    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.11.2'

    implementation 'com.jayway.jsonpath:json-path:2.4.0'

    implementation 'com.bisnode.response:responsekt:2.0.1-SNAPSHOT'

    testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude module: 'junit-vintage-engine'
        exclude module: 'mockito-core'
    }

    testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.2.4'

    testImplementation 'com.ninja-squad:springmockk:2.0.3'
    testImplementation 'io.mockk:mockk:1.10.0'
    testImplementation 'io.rest-assured:spring-mock-mvc:3.3.0'
    testImplementation 'io.projectreactor:reactor-test'
    testImplementation 'org.springframework.kafka:spring-kafka-test'
    testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9'
    testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo'

}
Thanks very much for helping me with this! 🙂
l

LeoColman

09/09/2020, 11:05 AM
It definitely looks like some JVM shenanigans
Try adding clickt yourself to the build
see if that can clear things up
But I'll drop a ping to @AJ Alt to take a look at this
Maybe that happened to other users of clickt
t

thol01

09/09/2020, 11:53 AM
Sorry for the late reply. Yes have tested to add implementation ‘com.github.ajalt:clikt:2.8.0’ to my project but I still get the same error.
It’s strange that version 4.2.0.RC works but no later versions. And again thanks for looking into this!
If I remember right the 4.2.0.RC uses clikt 2.7.0
l

LeoColman

09/09/2020, 12:19 PM
Ah, I think I got it
It has nothing to do with clikt, it's just unlucky to be the first one declared. Sorry, @AJ Alt
try
testImplementation("io.kotest:kotest-runner-junit5:4.2.3")
instead of junit5-jvm
t

thol01

09/09/2020, 1:17 PM
Have have done that but the same error.
One observation I tried testImplementation ‘io.kotest:kotest-runner-junit5-jvm:4.2.0.RC3’ and that gave me the same error as 4.2.x but in RC3 Gradle complain about “”Could not resolve com.github.ajalt.clikt:clikt-js:2.7.1 but RC2 uses 2.7.0 and everything works.
I tried the testImplementation(“io.kotest:kotest-runner-junit5:4.2.4”) and running the test from Intellij by right clicking on the test folder. And that works so it just using gradle by it self that does not work.
l

LeoColman

09/09/2020, 6:28 PM
@sam any idea?
s

sam

09/09/2020, 6:35 PM
I have seen it before myself, but cannot remember what it was. Something to do with setting up deps incorrectly.
@thol01 can you list all the deps that have io.kotest in them that are in your gradle files
t

thol01

09/10/2020, 4:59 AM
I’ll check.
Used this: gradle -q dependencyInsight --dependency io.kotest --configuration testRuntimeClasspath
s

sam

09/10/2020, 5:24 AM
Did you try adding the non-jvm versions of the deps ?
It's really strange the error you are having, it's gradle saying it can't find a module to match the requirements, but they clearly exist.
t

thol01

09/10/2020, 5:26 AM
This is if you run gradle -q dependencyInsight --dependency clikt --configuration testRuntimeClasspath
s

sam

09/10/2020, 5:28 AM
Is this an open source project ?
t

thol01

09/10/2020, 5:37 AM
My project? No sorry.
In the clikt.log one can see that clickt is jvm 14. But i think they specified 1.8 compatibility in there build gradle file. Is it that they compiled with 14 but the code is compatible with 1.8?
s

sam

09/10/2020, 5:43 AM
Probably, I mean I have Java 11 and use kotest no problem
Can you post up your current gradle file (as a snippet so it doesn't take up the entire screen) and I will make an empty project with it and see if the same thing happens
t

thol01

09/10/2020, 5:45 AM
It work in my project to as long as i stick to 4.2.0.RC2 but later version than that will not work.
One thing that I just saw now is that 4.2.0.RC2 has no dependence on Clikt. Using testImplementation ‘io.kotest:kotest-runner-junit5-jvm:4.2.0.RC2’
Found a solution!
testImplementation('io.kotest:kotest-runner-junit5-jvm:4.2.4') {
    exclude module: 'clikt'
}
Should have tested this before… sorry!
s

sam

09/10/2020, 6:25 AM
so it is clikt causing the issue ?
If you exclude clikt you won't be able to use the intellij plugin though
t

thol01

09/10/2020, 6:32 AM
Yes there is something wrong when clikt is a dependecy. Ahh so I cant use the plugin? The reason I put time into this was that my team what to use the plugin! 😣
s

sam

09/10/2020, 6:32 AM
I've just pushed to master a change that bumps clikt to 3.0.1
they've released a new major version, so hopefully this has "fixed" that issue. we'll find out once it's built and you try the snapshot.
t

thol01

09/10/2020, 6:33 AM
I will try that.
s

sam

09/10/2020, 6:33 AM
We'll get it working for you either way 🙂
t

thol01

09/10/2020, 6:33 AM
Let me know when I can try.
s

sam

09/10/2020, 6:34 AM
If 3.0.1 of clikt doesn't help, we'll reach out to AJ who writes it. He's a good guy who has contributed to kotest himself.
👍 1
t

thol01

09/10/2020, 6:34 AM
BIG thanks for helping me out here! 😀
s

sam

09/10/2020, 6:41 AM
are you on kotlin 1.4 ?
t

thol01

09/10/2020, 6:48 AM
Yes
s

sam

09/10/2020, 6:49 AM
clikt 3.0 is 1.4 only so that's ok
What's this
com.bisnode.response:responsekt
Also snapshot
4.3.0.664-SNAPSHOT
has been released
t

thol01

09/10/2020, 6:51 AM
It our own Kotlin implementation of https://google.github.io/styleguide/jsoncstyleguide.xml we use it as our main payload from all our microservices. It’s Kotlin 1.4 and JDK 11.
s

sam

09/10/2020, 6:52 AM
Ok I can't make it resolve, but I assume it doesn't matter, so I removed it from the thomas project
t

thol01

09/10/2020, 6:52 AM
ok
s

sam

09/10/2020, 6:52 AM
So I think we have found the issue, your build file is bringing in 4.1.1 of kotest
I guess something else uses it
Ah yeah you have it twice in your gradle file
t

thol01

09/10/2020, 6:53 AM
I do?
s

sam

09/10/2020, 6:53 AM
According to the one you pasted yeah
wait, I think I'm going crazy
t

thol01

09/10/2020, 6:54 AM
You are not alone!
s

sam

09/10/2020, 6:55 AM
alright, I've taken your build, added a dummy test, and pushed to that thomas repo
Run
./gradlew check
t

thol01

09/10/2020, 7:00 AM
It gives me the same error, but it works for you?
s

sam

09/10/2020, 7:01 AM
yep
actually no, didn't spot this
> Task :compileTestKotlin UP-TO-DATE
Errors occurred while build effective model from /home/sam/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-osgi/2.2.10/c926a537af564ec047ec6308df1d0d2a03364a86/jaxb-osgi-2.2.10.pom:
    'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-osgi:2.2.10
t

thol01

09/10/2020, 7:02 AM
That error has always been there… not only for this project…
So I get this: Could not resolve com.github.ajalt.clikt:clikt-js:2.8.0. Required by: project : > io.kotest:kotest-runner-junit5-jvm:4.2.4 > io.kotest:kotest-framework-engine:4.2.4 > io.kotest:kotest-framework-engine-jvm:4.2.4 > com.github.ajalt:clikt:2.8.0
My default JDK on my machine is 11.02.
s

sam

09/10/2020, 7:04 AM
then it passes for me
I'm on linux
sam@sam-H310M-A-2-0:~/development/workspace/kotest/thomas$ java -version openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment 18.9 (build 11.0.8+10) OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode)
t

thol01

09/10/2020, 7:06 AM
One “big” project I had 2 other developers test it one has windows the other mac (same as me). I also tried it on our build server Bamboo that runs some kind of Linux. All have the same error.
s

sam

09/10/2020, 7:07 AM
I've updated the project to include extra logging
and changed the test to fail so you can see it failing in std out
are you using gradlew ?
or just gradle ?
t

thol01

09/10/2020, 7:09 AM
gradlew
Pulled your changes but still the same error.
s

sam

09/10/2020, 7:09 AM
So you've just cloned that project, done gradlew check and it gives you the clikt error ?
t

thol01

09/10/2020, 7:10 AM
Yes
s

sam

09/10/2020, 7:10 AM
how strange
t

thol01

09/10/2020, 7:10 AM
./gradlew clean build
s

sam

09/10/2020, 7:10 AM
can you nuke your gradle and maven clickt folders
I will do the same
t

thol01

09/10/2020, 7:11 AM
Yes
s

sam

09/10/2020, 7:12 AM
It re-downloaded them fine for me
sam@sam-H310M-A-2-0:~/development/workspace/kotest/thomas$ ll ~/.gradle/caches/modules-2/files-2.1/com.github.ajalt/ total 36 drwxrwxr-x 5 sam sam 4096 Sep 10 02:11 ./ drwxrwxr-x 322 sam sam 20480 Sep 10 02:11 ../ drwxrwxr-x 3 sam sam 4096 Sep 10 02:11 clikt/ drwxrwxr-x 3 sam sam 4096 Sep 10 02:11 colormath/ drwxrwxr-x 3 sam sam 4096 Sep 10 02:11 mordant/
I've updated the project to explicitly add the clikt dependency now, to see if that pulls it down
t

thol01

09/10/2020, 7:16 AM
I can’t find the clikt lib’s on my computer…
I’ll pull our chanages
s

sam

09/10/2020, 7:17 AM
I guess it makes sense that you can't find it since it won't download for you
👍 1
t

thol01

09/10/2020, 7:19 AM
I’ll post the error file, just one minute
Seems like I can’t download the dependency.
s

sam

09/10/2020, 7:22 AM
So it doesn't look like a kotest thing. Lets try one more thing.
can you do a pull and gradlew check
t

thol01

09/10/2020, 7:23 AM
Works!
s

sam

09/10/2020, 7:24 AM
that's not good lol
I removed everything but clickt hoping it would still fail and we had the issue narrowed down
t

thol01

09/10/2020, 7:24 AM
So just add the dependencies one by one?
s

sam

09/10/2020, 7:25 AM
I guess so. Add them one by one until it fails for you, and then we'll know where to look.
Add kotest first
testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.2.4'
t

thol01

09/10/2020, 7:25 AM
I’ll do that and let you know
testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.2.4'
Works
s

sam

09/10/2020, 7:26 AM
so it's not that then
t

thol01

09/10/2020, 7:26 AM
All do the rest and let you know
s

sam

09/10/2020, 7:26 AM
Ok, I'm off to bed, 2:30am here
I'll catch up with you tomorrow to see how things are looking.
t

thol01

09/10/2020, 7:27 AM
Sleep well and THANKS!
👍🏻 1
Tested some more and as long as I don’t add any test it will complile BUT when I have a test it gives the error.
Ha a another developer in my team create a super small app as well and as soon as he add a test we get the error. Just to verify that it not my machine.
s

sam

09/10/2020, 1:37 PM
Are you on some weird vpn
Also what's you github username
t

thol01

09/11/2020, 7:14 AM
Yes I am on VPN. I will try with it disconnected.
Github username is thol01
Did try without the VPN but the same error. Also upgraded to Kotlin 1.4.10 same error. I tested a project with just testImplementation group: ‘com.github.ajalt’, name: ‘clikt’, version: ‘2.8.0’ and that fails for the same reson.