这篇文章上次修改于 2103 天前,可能其部分内容已经发生变化,如有疑问可询问作者。 ### java cannot find symbol of kotlin ``` [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/shenfeng/dev/thor-service/thor-content/src/main/java/tv/rr/thor/content/controller/CommonController.java:[9,39] cannot find symbol symbol: class GetTokenResponseData location: package tv.rr.thor.content.responseData [ERROR] /home/shenfeng/dev/thor-service/thor-content/src/main/java/tv/rr/thor/content/controller/CommonController.java:[54,25] cannot find symbol symbol: class GetTokenResponseData location: class tv.rr.thor.content.controller.CommonController `` 解决方案:把kotlin编译插件放在java编译插件的上面,另外需要kotlin在process-sources 阶段就执行 配置如下 ```xml org.jetbrains.kotlin kotlin-maven-plugin ${kotlin.version} compile process-sources compile ${project.basedir}/src/main/kotlin ${project.basedir}/src/main/java test-compile test-compile test-compile -Xjsr305=strict spring 1.8 org.jetbrains.kotlin kotlin-maven-allopen ${kotlin.version} org.apache.maven.plugins maven-compiler-plugin 3.8.0 default-compile none default-testCompile none java-compile compile compile java-test-compile test-compile testCompile 11 11 11 ```
没有评论