Hey :slightly_smiling_face: When using the `Script...
# scripting
n
Hey 🙂 When using the
ScriptJvmCompiler
I’m running into a this error:
Copy code
Using old JVM backend
java.lang.IllegalStateException: The provided plugin org.jetbrains.kotlin.samWithReceiver.SamWithReceiverComponentRegistrar is not compatible with this version of compiler
(Script is placed in
buildSrc
) Does anyone have an idea? JDK is 11.0.10 and Kotlin 1.5.10. https://scans.gradle.com/s/rdbi5m2x3g27o/failure#1
Also happening with kotlin
1.4.31
I was able to get it running by downgrading to gradle 6.7.1. It looks they added a dependency to the sam-receiver in v6.8.
kotlin-sam-with-receiver-compiler-plugin-1.4.20
So is this now a bug in gradle or in the scripting library 😄?
i
As far as I remember, gradle used sam-with-receiver plugin almost from the beginning, so the issue is definitely not a new dependency. But could you please give some more details how and where you're using the scripting compiler? Is it a part of your gradle plugin?
n
Hey @ilya.chernikov, thanks for responding! I created a minimal reproducible case here [1]. I think the problem might be related that I use the compiler in the
buildSrc
. Any idea for a work around or should I report it somewhere? [1] https://github.com/neugartf/ScriptJVMCompiler_SAM_Clash
i
Hi @neugartf Thanks for the repro! I checked it quickly, seems the problem is in the interference of the Kotlin compiler infrastructure embedded into Gradle, and the one that scripting compiler trying to create when compiling your script. The
buildSrc
stuff is executed inside Gradle, as far as I know, without much isolation (by design, to ensure that it can access necessary Gradle infrastructure without issues), so you cannot use any version of the kotlin libs there. But I tried to set it to 1.4.32 (used in the Gradle 7.1 you're using in the repro project), and it doesn't help, so the problem are deeper. I created an issue to track the problem - https://youtrack.jetbrains.com/issue/KT-47453 Meanwhile your only option so far is to run these scrips out of process, I guess.
🙇 1
n
Thanks for answering this and all your work here!