https://kotlinlang.org logo
Title
p

Pierre Marais

05/13/2020, 2:57 PM
Hi, is there any reason why an application cannot startup if it does an
implementation
instead of
testImplementation
of the kotlintest dependency? I.e. when I do
testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.2")
I have no issues, however when I do
implementation("io.kotlintest:kotlintest-runner-junit5:3.4.2")
I get this error when running my bundled jar:
Error: Could not find or load main class package.ApplicationKt
Caused by: java.lang.ClassNotFoundException: package.ApplicationKt
The strange thing is, that it works when I use gradlew to run the app, but it breaks when I assemble a jar and then run it.
s

sam

05/13/2020, 3:06 PM
I guess there's a file that clashes and kotlintest one wins out
p

Pierre Marais

05/14/2020, 7:34 AM
Thanks for the response. When trying to use the latest version of kotest, I can't get it to compile when adding the dependencies as
implementation
:
* What went wrong:
Could not resolve all files for configuration ':implementation'.
> Could not resolve io.kotest:kotest-runner-junit5-jvm:4.0.5.
  Required by:
      project :
   > Cannot choose between the following variants of io.kotest:kotest-runner-junit5-jvm:4.0.5:
       - 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.5:
           - Unmatched attributes:
               - Found org.gradle.libraryelements 'jar' but wasn't required.
               - 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.
       - Variant 'jvm-runtime' capability io.kotest:kotest-runner-junit5-jvm:4.0.5:
           - Unmatched attributes:
               - Found org.gradle.libraryelements 'jar' but wasn't required.
               - 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.
       - Variant 'metadata-api' capability io.kotest:kotest-runner-junit5-jvm:4.0.5:
           - Unmatched attributes:
               - 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.
Do you know of a way of using kotest Generators outside of just tests?
s

sam

05/14/2020, 7:59 AM
Are you using that protobuf plugin thing ?
It causes lots of issues
p

Pierre Marais

05/14/2020, 8:41 AM
Hmm no, I'm not using that. No worries, I've found some alternative way of getting things done 🙂 Thanks for the input