Error:Kotlin: Module was compiled with an incompatible version of Kotlin in a project of Spring Boot with Java not Kotlin not gradle

Error:Kotlin: Module was compiled with an incompatible version of Kotlin in a project of Spring Boot with Java not Kotlin not gradle

Intellij IDEA 和 JDK 11,这不是一个 android 项目,没有使用 Kotlin。它是一个 Spring 使用 initilizer 生成的启动应用程序。像这样:

https://start.spring.io/starter.zip?type=maven-project&language=java&bootVersion=2.6.3&baseDir=demo&groupId=com.example&artifactId=demo&name=multidatasource&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&packaging=jar&javaVersion=11&dependencies=lombok,data-jpa,mysql,webflux,data-rest

然后我在里面添加了服务代码。构建时,它因缺少错误而停止,我修复它们后,它根本无法构建,IDEA 给出错误:

Information:Kotlin: kotlinc-jvm 1.3.41 (JRE 11.0.4+10-b304.77)

Information:2/11/2022 3:20 PM - Build completed with 1 error and 0 warnings in 1 s 823 ms

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.15.

pom.xml 与上面生成的 link 相同。我检查了 IDEA 模块设置,没有什么奇怪的。 而我grep -rn kotlin *在项目文件夹中,没有匹配的结果。

然后我想是不是因为依赖有kotlin冲突,所以我从一个新的下载项目开始,运行成功了(证明kotlin问题不是因为依赖);然后我替换文件夹 src,它也成功 运行。

有没有人用过Spring Boot + Java + maven,IDEA,也许还有JDK11,遇到同样的错误?

谢谢。

更新: 我认为这是一个 Intellij IDEA 错误,并非所有 run 都有这个问题

我刚刚遇到了确切的问题。只需转到构建菜单并单击重建项目。