Kotest builds with Gradle 7.6 are failing. Anyone ...
# gradle
e
Kotest builds with Gradle 7.6 are failing. Anyone seen this problem already? https://github.com/kotest/kotest/pull/3302
Copy code
* What went wrong:
A problem occurred configuring project ':kotest-framework:kotest-framework-multiplatform-plugin-gradle'.
> Failed to notify project evaluation listener.
   > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: Provider org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin not a subtype
   > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: Provider org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin not a subtype
e
you're trying to use
plugins { kotlin() }
and `plugins {
kotlin-dsl
}` in the same project. this leads to problems when Gradle's embedded Kotlin version differs from your project's Kotlin version. notably, Gradle 7.6 embeds Kotlin 1.7.10
e
Thanks, I’ll have a look at that 😄
a
Gradle provides a variable to help with aligning the Kotlin version used in build scripts -
embeddedKotlinVersion
Copy code
// buildSrc/build.gradle.kts

plugins {
  // set the version of Kotlin that Gradle uses
  kotlin("jvm") version embeddedKotlinVersion
  `kotlin-dsl`
}

dependencies {
  // set the version of Kotlin used to build/run the project
  val kotlinVer = "1.7.21"
  implementation(platform(kotlin("bom", kotlinVer)))
  implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVer")
  implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVer")
}
c
‘kotlin-dsl’ and ‘kotlin(jvm )’ should not both be present in a project. If the project is building Gradle plugins/tasks use DSL plugin; if the project is a Kotlin app/library use the Kotlin plugin. ‘kotlin-dsl’ will pull in Gradle APIs and use embedded Kotlin version.
e
exactly. one Kotlin version across the whole build. you can mix `plugins {
kotlin-dsl
}` and `plugins {
embedded-kotlin
}`, but if you want to use
plugins { kotlin() }
you're better off separating them into separate (possible included) builds
324 Views