由于 kotlin 错误,Java Spring Boot 应用程序无法从 IDEA 运行

Posted

技术标签:

【中文标题】由于 kotlin 错误,Java Spring Boot 应用程序无法从 IDEA 运行【英文标题】:Java Spring Boot application doesn't run from IDEA due to kotlin error 【发布时间】:2021-08-15 11:31:00 【问题描述】:

我有一个纯 Java 编码的 Java Spring Boot 应用程序。当我尝试使用运行配置从 Intellij IDEA 运行它时,我收到以下错误:

Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16.

如果我从运行配置中删除构建步骤,使用 mvn clean install 构建然后运行应用程序,一切正常。

我尝试在 IDEA 中更改 Kotlin 编译器设置,但问题仍然存在。

【问题讨论】:

【参考方案1】:

Intellij 设置 -> 语言和框架 -> Kotlin -> 将更新频道更改为新版本

【讨论】:

【参考方案2】:

我在运行 Spring Boot 应用程序时遇到了同样的问题。对我来说,将我的 IDEA 更新到最新版本(2021.1.1 Ultimate Edition)为我解决了 Kotlin 的这个问题。

【讨论】:

很高兴能帮上忙。【参考方案3】:

intellij > 首选项 > 插件 > 已安装:“取消选中捆绑的 kotlin”

【讨论】:

以上是关于由于 kotlin 错误,Java Spring Boot 应用程序无法从 IDEA 运行的主要内容,如果未能解决你的问题,请参考以下文章

Spring Cloud Gateway - kotlin支持

Spring Cloud Gateway - kotlin支持

Spring Cloud Gateway - kotlin支持

Kotlin Spring Boot 验证不起作用

使用 Spring Boot 2 和 Kotlin 进行 Jackson 反序列化,无法构造 `java.time.LocalDate` 的实例

使用 kotlin 在 Spring Boot 中映射结构接口错误