This message was deleted.
# community-support
s
This message was deleted.
1
c
had a very similar issue. iirc, tried with
--refresh-dependencies
first and think I ended up removing ~/.gradle/caches.
👀 1
also - for 7.6.x, it s/b Kotlin 1.7,10; that error message is referencing 1.7.21, perhaps something is bumping the Kotlin version.
m
I bumped to 1.7.21 (which was released today I think)
c
The embedded Kotlin with Gradle is 1.7.10, best to stick with that for Gradle components (such as the referenced plugin-api).
m
ah embedded Kotlin!
c
yep, the root of both goodness… and challenges…
😅 1
m
Removing ~/.gradle/caches, see you in a bit !
Same thing with fresh new gradle caches
c
ok. Presuming this is a Gradle plugin. Ensure this is correct:
Copy code
plugins {
    `kotlin-dsl`
    // DO NOT use kotlin("jvm") here as this is a Gradle plugin that will use the embedded Kotlin, pulled in by `kotlin-dsl'
    // also: it's redundant to use `java-gradle-plugin` (already pulled in by `kotlin-dsl`
}
m
I'm using
Copy code
plugins {
  `embedded-kotlin`
  id("java-gradle-plugin")
}
I'm avoiding
fun String.invoke()
in my classpath 😅
c
ouch. that’s likely part of the problem. partial setup,
kotlin-dsl
does what you need.
what is the
String.invoke
issue?
m
clutters the global namespace
personal preference I guess
I'll remove the "java-gradle-plugin" part, see if that changes anything
c
it won’t work w/o it - that’s what pulls in the Gradle API. You want
kotlin-dsl
to write Gradle stuff.
m
I've done this before
And it's working with
7.5
c
not following why
kotlin-dsl
isn’t being used to pull in the standard set of things?
you can, of course, reproduce that yourself, including keeping up with changes between Gradle versions.
m
Turns out it's the "java-gradle-plugin" that seem to mess with resolution 🤔
c
perhaps flip the order? In
kotlin-dsl
they’re done in a different order:
Copy code
apply<JavaGradlePluginPlugin>()
        apply<KotlinDslBasePlugin>()
        apply<PrecompiledScriptPlugins>()
…the middle one is embedded kotlin.
m
Ah, good call, trying it
nope, same thing
I'll make a small reproducer
c
This is working on 7.6-rc-2:
Copy code
plugins {
    `embedded-kotlin`
    `java-gradle-plugin`
}

repositories {
    mavenCentral()
}
having said that, it’s minimal - no code, etc.
m
The
kotlin-gradle-plugin:1.7.21
is the one that fails to resolve
c
yea, guessing that is pulled in by the embedded kotlin. How was the 1.7.21 version specified? only seeing 1.7.10 resolved.
m
Mmmm this is working as well... I'll dig
Copy code
plugins {
  id("java-gradle-plugin")
  `embedded-kotlin`
}

repositories {
  mavenCentral()
}

dependencies {
  implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21")
}
c
even with the above it still pulls in kotlin-gradle-plugin (and other stuff) at 1.7.10. Visible via
./gradlew --refresh-dependencies --info | grep https
. Something else must be forcing 1.7.21.
something in settings.gradle.kts
buildscript
perhaps.
m
Alright, it all boils down to this:
Copy code
plugins {
  id("java-gradle-plugin")
  `embedded-kotlin`
}

repositories {
  mavenCentral()
}

dependencies {
  implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21")
  implementation("org.jetbrains.kotlin:kotlin-allopen:1.7.10")
}
c
that appears to work … wait … it fails when doing
./gradlew test
.
m
It fails to resolve the configuration
Aaahh
Error while evaluating property 'paths' of task ':pluginUnderTestMetadata'.
You're right, it's a test thing only
c
yea. wondering if forcing version alignment will fix this, trying that…
m
That explains why it's caused by the "java-gradle-plugin"
Aligning everything to 1.7.21 works
c
yea. have something in a plugin convention plugin to align Kotlin component versions, endless problems there…
m
Still a bit surprising but at least that solves my issue. Thanks for the help!
c
np. cheers.