in Education by
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)

1 Answer

0 votes
by
The warning you see during the compilation happens because jackson-module-kotlin:2.9.8 dependency apparently brings kotlin-stdlib:1.3.10 into the classpath and that version overrides your declared dependency on 1.2.71. To avoid warning you should either migrate your project to Kotlin 1.3.x or downgrade jackson-module-kotlin dependency to some previous version which depends on Kotlin 1.2.x. kotlin-stdlib-jdk8 is an addition on top of kotlin-stdlib-jdk7, and the latter is addition on top of kotlin-stdlib. You should not exclude these transitive dependencies, otherwise you might get runtime errors.

Related questions

0 votes
    for all the examples on the internet i cant figure out when and how is kotlins let ran? if(phones ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    for all the examples on the internet i cant figure out when and how is kotlins let ran? if(phones ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    How can I create array of buttons in android studio in Kotlin? I've created buttons with their ids ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    What does the territory of a state include? Please answer the above question....
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    What does the ‘holistic perspective’ of development include? Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    What is urban waste? What does it include? Select the correct answer from above options Science ... Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    What does biomedical waste include? Select the correct answer from above options Science questions and ... proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    What is disaster management? What actions does it include? Select the correct answer from above options ... proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    The Crockford's subset does not include which function in JavaScript? (a) eval() (b) coeval() (c ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    Mention what does path generators include in d3.js?...
asked Nov 14, 2020 in Technology by JackTerrance
0 votes
    I migrated to Android Studio 3 and Gradle 4. Then I changed compile to implementation in my build.gradle ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    The java project I am working on has a .bat file and a .sh file which build the CLASSPATH for ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    The java project I am working on has a .bat file and a .sh file which build the CLASSPATH for ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    What exactly is classpath, what value does it hold ? Can you also tell me the command that can be used to set classpath ? Select the correct answer from above options...
asked Jan 23, 2022 in Education by JackTerrance
...