首页 > 解决方案 > Eclipse 看不到 Gradle 提供的 jar

问题描述

我们有一个我正在尝试在 Eclipse 中使用的 Gradle 项目。在其他用户进行更改并且我不得不进行 Gradle Refresh 之后,Eclipse 现在无法编译该项目。

The project was not built since its build path is incomplete. Cannot find the class file for
   org.springframework.retry.support.RetryTemplate. Fix the build path then try building this project   

The type org.springframework.retry.support.RetryTemplate cannot be resolved. It is indirectly 
  referenced from required .class files RabbitMQConfig.java /Account/src/main/java/com/efi/metrix/config    line 1  Java Problem

如果我使用 Ctrl-T,我可以看到该类及其所在的 jar。该 jar 位于类路径中,可以在 Package Explorer 的“项目和外部依赖项”部分下看到。

我尝试删除 jar 并重新运行 Gradle Refresh,它会再次下载 jar,但构建失败时出现相同的错误。我还在该项目上尝试了 Eclipse Clean。(我也尝试过重新启动 Eclipse。)

关于可能导致这种情况的任何提示?

标签: javaeclipsegradle

解决方案


终于找到了这个。Eclipse 项目,Properties -> Java Compiler -> Errors/Warnings 在“Enable annotation-based null analysis”部分,如果启用了“Inherit null annotations”,则会出现编译错误。我关闭了该选项,它现在编译没有错误。


推荐阅读