-
Notifications
You must be signed in to change notification settings - Fork 428
kotlin-compiler-embeddable version clash when applying kotlin-gradle-plugin via buildSrc #1207
Comments
This is a breaking change in the |
I there any way I can try forcing a specific Kotlin version on Gradle 5.0-rc-1? I mean, it already embeds 1.3.0, so I can't set anything newer (yet). Is building 1.2.7x projects with Gradle 5.0 supported, despite the embedded 1.3.0 compiler? |
Hi. I'm trying to update Kotlin version to 1.4.0-rc but it's not working. I have the same error as @kris7t.
or
I've tried Gradle 6.5 and 6.6-rc-3. |
@TomasKuhn were you able to find a solution to this? I also tried with gradle 6.6-rc-4 and nothing :/ |
There is no solution yet. It's defined in Gradle, so we have to wait on new Gradle version which use Kotlin 1.4 for |
This Repo is only about samples. Maybe the is already an issue with that at
gradle/gradle? Maybe worth to check it out...
…On Fri, Jul 31, 2020, 9:15 AM Tomáš Kuhn ***@***.***> wrote:
There is no solution yet. It's defined in Gradle, so we have to wait on
new Gradle version which use Kotlin 1.4 for kotlin-dsl
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1207 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACOBQ6562IK3CJWW4NZQWELR6JVRFANCNFSM4F7I4S3A>
.
|
There seem to be a clash between dependencies of the
kotlin-compiler-embeddable
used to compile thebuildSrc
module and thekotlin-gradle-plugin
used in the rest of the build when I try to apply or configure the plugin from another plugin placed inbuildSrc
. As I have to addkotlin-gradle-plugin
to theclasspath
ofbuildSrc
in this case (instead of applying in from theplugins
block of the root project), transitive dependency resolution seems to select the incorrect version ofkotlin-compiler-embeddable
(1.2.61 instead of 1.2.71), leading to a build failure due to class incompatibility.Expected Behavior
When adding
kotlin-gradle-plugin
as a dependency in thebuildSrc
module, the appropriate Kotlin compiler should be present in the classpath of the rest of the build (as ifkotlin-gradle-plugin
was applied as a plugin in the root project, with explicitly specified version).Current Behavior
When trying to write a plugin inside
buildSrc
that applieskotlin-gradle-plugin:1.2.71
, the build fails with the following exception:The reason for this seems to be the incorrect version of
kotlin-compiler-embeddable
:It seems that the dependency used by the embedded Kotlin version (1.2.61) "leaks" from the
kotlinCompiler
configuration ofbuildSrc
to the rest of the configurations.There is no version clash if I apply the
kotlin-gradle-plugin
to the root project (with explicitly specified version). Of course, in this case it is impossible to add it to thebuildSrc
dependencies, since no version can be specified for plugins already on the build classpath. This prevents me from writing a custom plugin inbuildSrc
that configures the Kotlin compiler.There is also no version clash if I downgrade to Kotlin 1.2.61 in the project.
As a workaround I can force the embeddable Kotlin compiler to 1.2.71 in the
buildSrc
as follows:Simply using
force
did not help, because the dependency version is apparently selected by rule. I presume I have to write another rule to override in this case.Context
I'm trying to store common configuration across modules using plugins defined in
buildSrc
in a project where the modules, thebuildSrc
plugins, and the build scripts are all written in Kotlin.As an example of such configuration, see https://github.com/FTSRG/theta-jani-interchange/blob/84cbe35d2e7b9661319fb450694099c770b9a656/buildSrc/src/main/kotlin/hu/bme/mit/inf/theta/interchange/jani/buildsrc/KotlinConventions.kt
Steps to Reproduce (for bugs)
kotlin-dsl
inbuildSrc
.compile(kotlin("gradle-plugin", "1.2.71"))
to thebuildSrc
moduledependencies
buildSrc
that runsapply<KotlinPlatformJvmPlugin>()
in itsapply
method./gradlew compileKotlin
Your Environment
buildSrc
module: https://scans.gradle.com/s/nc6r7elxdc2fkbuildSrc
module: https://scans.gradle.com/s/53ebet6xmtneaRelevant versions:
kotlin-dsl
using Kotlin 1.2.61Note that the build also contains the
io.gitlab.arturbosch.detekt
plugin, which is applied from theplugins
block of the root project as usual. Even though it is written in Kotlin 1.2.61, it does not disturb the build whenkotlin-gradle-plugin
is also applied from theplugins
block (and notbuildSrc
dependencies
). This highlights that there is no clash of differing Kotlin versions, unless the clash involvesbuildSrc
.The text was updated successfully, but these errors were encountered: