Kotlin序列化插件更新到1.7.10后Gradle失败

vu8f3i0k  于 2023-03-13  发布在  Kotlin
关注(0)|答案(2)|浏览(315)

我的build.gradle.kts的开头如下:

...
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
  ...
  
  kotlin("jvm") //target version is java 11
  kotlin("plugin.serialization") version "1.6.21"
}

当我尝试将Kotlin序列化插件更新到最新的1.7.10 version时,我得到了以下编译错误:

A problem occurred configuring project ':my-little-project'.
> Failed to notify project evaluation listener.
   > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin not a subtype
   > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin not a subtype

我该怎么补救?谢谢!
堆栈跟踪(太大,无法完全发布,有关详细信息,请询问):

Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':my-little-project'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:68)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.access$400(LifecycleProjectEvaluator.java:51)
...
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:89)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:346)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:249)
...
gv8xihay

gv8xihay1#

感谢@aSemy列出了问题所在。我们的微服务架构意味着还有另一个重要的build.gradle.kts文件,其中包含以下行,也需要更新:

kotlin("jvm") version "1.6.10" apply false
14ifxucb

14ifxucb2#

替代使用
ID 'Kotlin'版本'1.6.10'应用错误

  • build.gradle文件 * 中的插件内部

相关问题