Eric Kolotyluk
Eric Kolotyluk

Reputation: 2243

Why does Gradle report an unexpected Kotlin verion?

% ./gradlew -version

------------------------------------------------------------
Gradle 7.0.2
------------------------------------------------------------

Build time:   2021-05-14 12:02:31 UTC
Revision:     1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.10 (GraalVM Community 11.0.10+8-jvmci-21.0-b06)
OS:           Mac OS X 10.16 x86_64

But in my build.gradle file I have

buildscript {
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"          
    }

allprojects {
    apply plugin: 'idea'
    apply plugin: 'org.jetbrains.kotlin.jvm'
    . . .
}

Why does Gradle report an unexpected Kotlin version?

Based on my project, it really is using Kotlin 1.5 features, so I don't understand why Gradle is reporting something different.

Upvotes: 0

Views: 144

Answers (1)

laalto
laalto

Reputation: 152787

gradle -version reports the versions gradle itself is using. It has nothing to do with your project. You can run gradle -version is a directory that does not contain any gradle project and get the same output.

You can see the kotlin version the project is using by dumping build-time dependencies with the buildEnvironment task. For example:

$ ./gradlew buildEnvironment | grep kotlin-gradle-plugin:
+--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10

Upvotes: 4

Related Questions