如何使用kotlin-dsl Gradle插件从Kotlin 1.2迁移到1.3? [英] How to migrate from Kotlin 1.2 to 1.3 with the kotlin-dsl Gradle plugin?
问题描述
我当前正在使用 kotlin-dsl Gradle插件0.18.2 ,科特林1.2.51 和 Gradle 4.10.2 在我的
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
一旦我运行Gradle任务,它就会失败并显示以下错误:
As soon as I run a Gradle task it fails with the following error:
警告:不支持的Kotlin插件版本.
embedded-kotlin
和kotlin-dsl
插件依赖Kotlin1.2.61
的功能,这些功能可能与所请求的版本1.3.10
不同.
WARNING: Unsupported Kotlin plugin version. The
embedded-kotlin
andkotlin-dsl
plugins rely on features of Kotlin1.2.61
that might work differently than in the requested version1.3.10
.
除了 kotlin的发行说明中写的内容之外,是否还有迁移指南? -dsl Gradle插件 ?
推荐答案
迁移问题的根源是buildSrc
文件夹的配置错误.我将其视为 settings.gradle 文件中的模块:
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:
包括':app',':buildSrc',':database',':network'
include ':app', ':buildSrc', ':database', ':network'
相反,它应被视为
Paul Merlin @eskatos 提供的解决方案是简单地删除其中的buildSrc
文件夹:
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:
包括':app',':数据库',':网络'
include ':app', ':database', ':network'
这篇关于如何使用kotlin-dsl Gradle插件从Kotlin 1.2迁移到1.3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!