https://kotlinlang.org logo
#spek
Title
# spek
n

Nikky

09/01/2018, 12:25 PM
Copy code
org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'spek2' failed to discover tests
java.lang.NoClassDefFoundError: kotlin/streams/jdk8/StreamsKt
when i just tried to upgrade the spek version
r

raniejade

09/01/2018, 12:27 PM
Can you include the build file?
n

Nikky

09/01/2018, 12:48 PM
build.gradle
it loads some subprojects as testDependencies so i can well.. test them and there is basically nothing else going on in the root project
r

raniejade

09/01/2018, 12:51 PM
You have to add a dependency to kotlin-stdlib since your excluding it from the spek dependencies
n

Nikky

09/01/2018, 1:05 PM
thencommenting out the exclude rules should fix it too ..
i just took the samples fro mthe website
i ended up needing a vers specific dependency on kotlin-stdlib-jdk8
this is what ended up working
Copy code
dependencies {
    testImplementation project(":voodoo")
    testImplementation (group: 'org.spekframework.spek2', name: 'spek-dsl-jvm', version: spek_version)  {
        exclude group: 'org.jetbrains.kotlin'
    }
    testRuntimeOnly (group: 'org.spekframework.spek2', name: 'spek-runner-junit5', version: spek_version) {
        exclude group: 'org.junit.platform'
        exclude group: 'org.jetbrains.kotlin'
    }
    testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: kotlin_version
    testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version

    // <https://mvnrepository.com/artifact/org.junit.platform/junit-platform-engine>
    testImplementation group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.3.0-RC1'

    // spek requires kotlin-reflect, can be omitted if already in the classpath
    testRuntimeOnly group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_version
}
r

raniejade

09/01/2018, 1:24 PM
You're missing this one:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
which is stated on the website.
n

Nikky

09/01/2018, 1:32 PM
i tied that but it would fail at runtime.. apparently spek can then not find the jdk8 streams at runtime
r

raniejade

09/01/2018, 1:33 PM
ahh, yes - my bad. That should be
kotlin-stdlib-jdk8
now.
n

Nikky

09/01/2018, 1:33 PM
but i am fine with
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version
since the root project really does not need to produce artifacts
27 Views