gcp-gradle-build-cache icon indicating copy to clipboard operation
gcp-gradle-build-cache copied to clipboard

Kotlin stdlib does not match Gradle's embedded Kotlin version

Open aSemy opened this issue 1 year ago • 0 comments

When I look in the .module metadata for the Gradle plugins I can see that they have a dependency on kotlin-stdlib 1.9.22

      "dependencies": [
        {
          "group": "org.jetbrains.kotlin",
          "module": "kotlin-stdlib",
          "version": {
            "requires": "1.9.22"
          }
        }
      ],

https://plugins.gradle.org/m2/androidx/build/gradle/gcpbuildcache/gcpbuildcache/1.0.0-beta07/

The dependency is automatically added by the Kotlin JVM plugin.

This does not match the version of Kotlin that is embedded with Gradle. In fact, in order to be compatible with a wide range of Gradle version no dependency should be specified at all. The Kotlin stdlib dependency will be provided at runtime by Gradle.

Suggestions

  • Replace the Kotlin/JVM plugin with the embedded-kotlin plugin (I recommend this, it's easier!)

      // build.gradle.kts
      plugins {
          id("maven-publish")
          id("signing")
          id("bundle")
          alias(libs.plugins.gradle.publish)
    -     alias(libs.plugins.kotlin.jvm)
    +     `embedded-kotlin`
      }
    
  • Manually exclude the kotlin-stdlib dependency (for an example, see Dokka Gradle Plugin).

aSemy avatar Mar 16 '24 10:03 aSemy