Hello! :wave: I am trying to switch our medium-siz...
# kotest
a
Hello! 👋 I am trying to switch our medium-sized Kotlin project from using
kotlintest
to
kotest
. However, we have a grpc project, where Kotest is having some issues. Has anybody seen this? Would you have suggestions on how to fix it?
Copy code
* What went wrong:
Execution failed for task ':integration-grpc-server:extractIncludeTestProto'.
> Could not resolve all files for configuration ':integration-grpc-server:testCompileProtoPath'.
   > Could not resolve io.kotest:kotest-runner-junit5-jvm:4.0.2.
     Required by:
         project :integration-grpc-server
      > Cannot choose between the following variants of io.kotest:kotest-runner-junit5-jvm:4.0.2:
          - jvm-api
          - jvm-runtime
          - metadata-api
        All of them match the consumer attributes:
          - Variant 'jvm-api' capability io.kotest:kotest-runner-junit5-jvm:4.0.2:
              - Unmatched attributes:
                  - Found org.gradle.status 'release' but wasn't required.
                  - Found org.gradle.usage 'java-api' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.libraryelements 'resources' and found compatible value 'jar'.
          - Variant 'jvm-runtime' capability io.kotest:kotest-runner-junit5-jvm:4.0.2:
              - Unmatched attributes:
                  - Found org.gradle.status 'release' but wasn't required.
                  - Found org.gradle.usage 'java-runtime' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'jvm' but wasn't required.
              - Compatible attribute:
                  - Required org.gradle.libraryelements 'resources' and found compatible value 'jar'.
          - Variant 'metadata-api' capability io.kotest:kotest-runner-junit5-jvm:4.0.2:
              - Unmatched attributes:
                  - Required org.gradle.libraryelements 'resources' but no value provided.
                  - Found org.gradle.status 'release' but wasn't required.
                  - Found org.gradle.usage 'kotlin-api' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'common' but wasn't required.
Jvm version:
Using java version 13.0.2.hs-adpt
This worked fine with the latest version of
kotlintest
.
l
I've never seen that.
My first suggestion would be to try and update your Gradle version
So we can discard maybe old gradle bugs
s
If it's an old version of gradle but anything 6+ should be good
I've never seen this jvm-api / runtime thing before
Must be something odd in the "protopath" thing? Does grpc have it's own gradle plugin / source roots
a
Using the latest version of Gradle:
Copy code
% ./gradlew --version

------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          13.0.2 (AdoptOpenJDK 13.0.2+8)
OS:           Mac OS X 10.15.4 x86_64
Something is funky with this subproject, I did not set it up. I was hoping someone has bumped into this and could say, "hey, just set the java version" or something like that.
s
yeah never seen those errors before
I'm tempted to think it's that protoPath plugin
a
Ha, it seems others are bumping into this: https://github.com/google/protobuf-gradle-plugin/issues/391
I cloned this repo: https://github.com/olamelin/protobuf-gradle-plugin-issue Just build it with
./gradlew build
to replicate the issue. I added this to the
protomodule/build.gradle.kts
file so it looks like this:
Copy code
plugins {
	kotlin("jvm")
    id("com.google.protobuf") version "0.8.11"
}

dependencies {
    implementation(project(":okhttp"))
}

configurations.forEach {
    if (it.name.toLowerCase().contains("proto")) {
        println(it.name.toLowerCase())
        it.attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, "java-runtime"))
    }
}
And it works!
s
There you go