https://kotlinlang.org logo
Title
b

bitkid

10/20/2020, 9:55 AM
i tried out the new gradle 6.7 .. i run ./gradlew init and create a kotlin multi module project. beside that the compile fails of the inital creation i have another question. init creates a buildSrc with kotlin.kotlin-common-conventions.gradle.kts, library-convention and application-convention. the plugin dependencies in these files don't contain a version so the plugin block for now looks like this this. plugins { kotlin("jvm") jacoco
maven-publish
} everything works so far .. the only thing is it uses an old kotlin version. how can i force it to 1.4.10 for everything (buildsrc and sub modules). as soon as i put a version somewhere (in my root build.gradle.kts as an example) i get the error message "Plugin request for plugin already on the classpath must not include a version". any ideas?
if i try to set the plugin version in my build.gradle.kts in /buildSrc i get the message "The
embedded-kotlin
and
kotlin-dsl
plugins rely on features of Kotlin
1.3.72
that might work differently than in the requested version
1.4.10
."
j

Javier

10/20/2020, 10:13 AM
Is the repo public?
That warning is normal btw
b

bitkid

10/20/2020, 10:16 AM
no .. can't make it public .. but it's basically the default which the ./gradle init spits out
it uses by default kotlin 1.3.72 .. but i wan't it to use 1.4.10
for everything
j

Javier

10/20/2020, 10:21 AM
but 1.3.72 is used inside buildSrc and build.gradle.kts files, for "normal" projects it is being used the version you defined
can you share the snippet which is using the kotlin version?
b

bitkid

10/20/2020, 10:27 AM
let me see if i can come up with something
ah .. the initial build only fails if you call your project "kotlin" 🙂
ok i have an easy reproducer (you need gradle 6.7 for that) .. just run ./gradle init in an empty directory with these options:
$ ./gradlew init

Select type of project to generate:
  1: basic
  2: application
  3: library
  4: Gradle plugin
Enter selection (default: basic) [1..4] 2

Select implementation language:
  1: C++
  2: Groovy
  3: Java
  4: Kotlin
  5: Scala
  6: Swift
Enter selection (default: Java) [1..6] 4

Split functionality across multiple subprojects?:
  1: no - only one application project
  2: yes - application and library projects
Enter selection (default: no - only one application project) [1..2] 2

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Kotlin) [1..2] 2

Project name (default: tmpGradle): test
Source package (default: test):
there will be file list\src\main\kotlin\test\list\LinkedList.kt and in there put something which is a language feature of 1.4.10
i use
fun interface IntPredicate { fun accept(i: Int): Boolean }
with 1.3.72 you'll get an error like this: Expecting function name or receiver type
so where do i tell the whole thing to use 1.4.10 🙂
j

Javier

10/20/2020, 11:12 AM
b

bitkid

10/20/2020, 12:06 PM
ok that works but i get tons of warnings .. can i safely ignore them? or where do they come from?
$ ./gradlew build

> Task :buildSrc:compileKotlin
The `kotlin-dsl` plugin applied to project ':buildSrc' enables experimental Kotlin compiler features. For more information see <https://docs.gradle.org/6.7/userguide/kotlin_dsl.html#sec:kotlin-dsl_plugin>
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/sadatgus/.gradle/wrapper/dists/gradle-6.7-bin/efvqh8uyq79v2n7rcncuhu9sv/gradle-6.7/lib/kotlin-stdlib-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/wrapper/dists/gradle-6.7-bin/efvqh8uyq79v2n7rcncuhu9sv/gradle-6.7/lib/kotlin-stdlib-common-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/wrapper/dists/gradle-6.7-bin/efvqh8uyq79v2n7rcncuhu9sv/gradle-6.7/lib/kotlin-stdlib-jdk7-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/wrapper/dists/gradle-6.7-bin/efvqh8uyq79v2n7rcncuhu9sv/gradle-6.7/lib/kotlin-stdlib-jdk8-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/wrapper/dists/gradle-6.7-bin/efvqh8uyq79v2n7rcncuhu9sv/gradle-6.7/lib/kotlin-reflect-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.3.72/916d54b9eb6442b615e6f1488978f551c0674720/kotlin-stdlib-jdk8-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.4.10/e2b3c6695eee6085e606d96d685396dce23a3a06/kotlin-reflect-1.4.10.jar (version 1.4)
    C:/Users/sadatgus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.72/3adfc2f4ea4243e01204be8081fe63bde6b12815/kotlin-stdlib-jdk7-1.3.72.jar (version 1.3)
    C:/Users/sadatgus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.10/ea29e063d2bbe695be13e9d044dcfb0c7add398e/kotlin-stdlib-1.4.10.jar (version 1.4)
    C:/Users/sadatgus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.10/6229be3465805c99db1142ad75e6c6ddeac0b04c/kotlin-stdlib-common-1.4.10.jar (version 1.4)
w: Consider providing an explicit dependency on kotlin-reflect 1.4 to prevent strange errors
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
j

Javier

10/20/2020, 12:15 PM
I am ignoring them because we can't upgrade kotlin dsl version
I think 6.8 will have Kotlin 1.4 (or 1.4.10), but it will not be 1.4.20 probably and 1.4.20 will be available (more or less), so I don't know if there is an strategy to solve this problem
b

bitkid

10/20/2020, 8:10 PM
ok cool .. got everything working. thx! 🙂