it seems that gradle downgrades my kotlin dependen...
# gradle
c
it seems that gradle downgrades my kotlin dependencies in my test classpath.
i specify 1.3.11 in my gradle file and its all ok in the compile and runtime classpath, but it seems that in the test classpath the transitive dependencies of my test libraries override my kotlin version
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val junit5Version = "5.3.2"
val junitPlatformVersion = "1.3.2"

plugins {
    java
    kotlin("jvm") version "1.3.11"
    id("com.github.ben-manes.versions") version "0.20.0"

}

group = "cs"
version = "1.0-SNAPSHOT"

repositories {
    //    maven { setUrl("<http://dl.bintray.com/kotlin/kotlin-eap>") }
    jcenter()
    mavenCentral()
}

dependencies {
    implementation(kotlin("stdlib-jdk8"))
    implementation(kotlin("stdlib"))
    implementation(kotlin("reflect"))
    testImplementation("io.strikt:strikt-core:0.17.1")
    testImplementation("com.oneeyedmen:minutest:0.33.0")

    testImplementation("org.junit.jupiter:junit-jupiter-api:$junit5Version")
    testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitPlatformVersion")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit5Version")

}

configure<JavaPluginConvention> {
    sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

tasks.withType<Test> {
    useJUnitPlatform {
        includeEngines("junit-jupiter")
    }
    testLogging {
        events("passed", "skipped", "failed")
    }
}
Copy code
runtimeClasspath - Runtime classpath of compilation 'main' (target  (jvm)).
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.11
|    |    \--- org.jetbrains:annotations:13.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11
|         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11 (*)
\--- org.jetbrains.kotlin:kotlin-reflect:1.3.11
     \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11 (*)

runtimeElements - Elements of runtime for main. (n)
No dependencies

runtimeOnly - Runtime only dependencies for compilation 'main' (target  (jvm)). (n)
No dependencies

runtimeOnlyDependenciesMetadata
No dependencies

testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies

testApi - API dependencies for compilation 'test' (target  (jvm)). (n)
No dependencies

testApiDependenciesMetadata
No dependencies

testCompile - Dependencies for compilation 'test' (target  (jvm)) (deprecated, use 'testImplementation ' instead).
No dependencies

testCompileClasspath - Compile classpath for compilation 'test' (target  (jvm)).
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11 -> 1.3.10
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.10 -> 1.3.11
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.11
|    |    \--- org.jetbrains:annotations:13.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10
|         \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.10 -> 1.3.11 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11 (*)
+--- org.jetbrains.kotlin:kotlin-reflect:1.3.11
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11 (*)
+--- io.strikt:strikt-core:0.17.1
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10 (*)
+--- com.oneeyedmen:minutest:0.33.0
\--- org.junit.jupiter:junit-jupiter-api:5.3.2
     +--- org.apiguardian:apiguardian-api:1.0.0
     +--- org.opentest4j:opentest4j:1.1.1
     \--- org.junit.platform:junit-platform-commons:1.3.2
          \--- org.apiguardian:apiguardian-api:1.0.0`
c
Are you using Gradle 5.0?
If so, they changed the behaviour, now implementation/api doesn't affect the test classpath
c
okm but whats the correct way to do this then?
c
I haven't had any issues with that yet, and maybe I'm wrong, but I would try adding the dependency you want as
testImplementation
c
declaring my kotlin dependencies twice?
to me that really looks like a bug
c
Hum..then file an issue in Gradle GitHub, if it is a bug they'll fix it and if not they'll give you and answer and will be searchable for the next with the same issue
Actually I think I said something stupid, the change is: https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#rel5.0:pom_compile_runtime_separation Nothing related to testImplementation
So you can ignore my replies...
c
thanks anyway!