How to migrate from Kotlin 1.2 to 1.3 with the kotlin-dsl Gradle plugin?

徘徊边缘 提交于 2020-03-23 15:37:20

问题


I am currently using the kotlin-dsl Gradle plugin 0.18.2, Kotlin 1.2.51 and Gradle 4.10.2 in my Android project (take a look at the temporary project-setup branch).
I like to migrate to Kotlin 1.3. However, I have difficulties in finding out which combination of version works. I raised the dependencies to their latest version:

// in build.gradle.kts:
id("org.gradle.kotlin.kotlin-dsl") version "1.0.4"  

...

// in build.gradle:
org.jetbrains.kotlin:kotlin-stdlib:1.3.10 

As soon as I run a Gradle task it fails with the following error:

WARNING: Unsupported Kotlin plugin version. The embedded-kotlin and kotlin-dsl plugins rely on features of Kotlin 1.2.61 that might work differently than in the requested version 1.3.10.

Is there a migration guide besides what is written in the release notes of the kotlin-dsl Gradle plugin?

Related

  • kotlin-dsl issue #1269: Build failed with NoSuchMethodError: KotlinPluginWrapperKt.getKotlinPluginVersion

回答1:


The source of the migration problems was a misconfiguration of the buildSrc folder. I was treating it as a module in the settings.gradle file:

include ':app', ':buildSrc', ':database', ':network'

Instead it should be treated as an included build as stated in the Gradle documentation.
The solution given by Paul Merlin, @eskatos was to simply remove the buildSrc folder there:

include ':app', ':database', ':network'



来源:https://stackoverflow.com/questions/53558142/how-to-migrate-from-kotlin-1-2-to-1-3-with-the-kotlin-dsl-gradle-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!