Trying to create a gradle plugin in the buildsrc d...
# gradle
k
Trying to create a gradle plugin in the buildsrc directory and get this cryptic error even though my build.gradle.kts and plugin definitions seem ok: Cannot access 'java.lang.Object' which is a supertype of ConfigPlugin. Check your module classpath for missing or conflicting dependencies and there are bunch of warnings about Kotlin stdlib conflicts between 1.3.72 and 1.4.10. Kotlin 1.4 includes its own stdlib so I don't see why it's complaining about these conflicts? Gradle is version 6.7
build.gradle.kts
ConfigPlugin.kt in buildSrc/src/main/kotlin
t
You can remove
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.10")
because it is automatically added by the
kotlin-gradle-plugin
.
kotlin-dsl
is a short-form - please look up the sources. it might introduce a different version as the implementation dependencies listed below. in general: the
buildSrc
folder and other modules in your project cannot have different kotlin versions. please verify this.
m
AFAIK it was fixed in Gradle 6.8-20201015220041+0000 and newer, see here: https://github.com/gradle/gradle/issues/12660
1
k
Just an update...got the compiles to work by doing this...the buildscript kotlin plugin version has to match what's embedded in Gradle (totally not obvious). You can set the project's Kotlin version in the dependencies list to 1.4 but it compiles about runtime JAR files in the classpath should not be different. Also all the classes have code completion but everything in buildSrc is complaining that it can't find java.lang.Object and java.lang.Comparable. Kotlin build scripts still feel "not quite ready"...haven't played with them in a while because it always seems like people are in pain when they use them, but code completion is nice 🙂