Do you know any workaround to write a Gradle plugi...
# eap
h
Do you know any workaround to write a Gradle plugin using Kotlin 2.1.0 and Gradle 8.10 (using language version 1.8)? Currently, I get this error:
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
Do I really need to wait for Gradle 9 using Kotlin 2.0 language version (or even 2.1)?
1
b
h
Looks like you don't use precompiled scripts like I do. I get the error for the
Task :gradle-plugin:compilePluginsBlocks FAILED
task.
a
@hfhbd, hello! Have you tried to specify compatibility modes? There is also a mention of a possible workaround. And another one. Do you use Android Gradle Plugin? Can you please also provide the whole error message and the project with the issue? If yes. then can you please create a ticket via YouTack? Thank you! cc @tapchicoma
t
Kotlin runtime only supports Kotlin Language Version +1 for JVM artifacts meaning Kotlin 1.9.x (current Kotlin runtime) supports only LV 2.0. AFAIK Gradle 8.11 should use Kotlin 2.0.20 runtime which will solve this issue for this Gradle version. If you are developing Gradle plugin in Kotlin I would advice you to specifically configure Kotlin language version to minimally supported in plugin supported minimal Gradle version Kotlin runtime.
h
Updating to Gradle 8.11 did the trick. When I downgrade the api version to 1.9, I get another error from ksp 🫠 Will create a reproducer, but in the mean time I use a nightly version of Gradle.
s
@hfhbd had to upgrade to 8.11 because 2.1.0-Beta2 doesn’t work for build-logic plugins.. After updating to 8.11-milestone-1, the build starts throwing the following error
Copy code
* What went wrong:
Could not determine the dependencies of task ':check'.
> Could not create task ':test'.
   > Could not create task of type 'Test'.
      > Could not create an instance of type org.gradle.api.internal.tasks.testing.DefaultTestTaskReports.
         > Could not create an instance of type org.gradle.api.reporting.internal.DefaultReportContainer.
            > Type T not present
Have you seen any such error? Seems like right now the only option is to wait for the official 8.11 release to use Beta2 with pre-compiled plugins 😐
h
Hm, no I don’t have that problem, I use Gradle 8.11-milestone-1 with 2.1.0-Beta2 without problems, but I also don’t use the test report function 😅
366 Views