I'm using Kotlin to build a web service and I stumbled upon what I consider to be a strange curiosity. With this build.gradle:
group 'com.example'
version '0.1.0'
buildscript {
ext.kotlinVersion = '1.2.71'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
apply plugin: 'kotlin'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
I get this error during compilation:
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
.../kotlin-stdlib-jdk8-1.2.71.jar (version 1.2)
.../kotlin-stdlib-jdk7-1.2.71.jar (version 1.2)
.../kotlin-reflect-1.3.10.jar (version 1.3)
.../kotlin-stdlib-1.3.10.jar (version 1.3)
.../kotlin-stdlib-common-1.3.10.jar (version 1.3)
OK, no problem, jackson-module-kotlin is pulling in the kotlin 1.3 dependencies. I can exclude them. But the bit that caught my attention was the second line. kotlin-stdlib-jdk8 is also pulling in kotlin-stdlib-jdk7. In fact, I can exclude it and everything still runs as expected:
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") {
exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib-jdk7"
}
Why is kotlin-stdlib-jdk8 pulling onto my classpath the seemingly unnecessary kotlin-stdlib-jdk7?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)