[英]How do I resolve compilation errors that show up on classes but not projects in Eclipse when using Maven?
I'm getting compilation errors when I open a specific class file in Eclipse. 我在Eclipse中打开特定的类文件时遇到编译错误。 However, the class doesn't show a compilation error icon in the Project Explorer.
但是,该类不会在Project Explorer中显示编译错误图标。 I have enabled dependency management by right-clicking the project and using the Maven menu.
我通过右键单击项目并使用Maven菜单启用了依赖项管理。
I'm using Eclipse 3.7.1 and Maven 2.2.1. 我正在使用Eclipse 3.7.1和Maven 2.2.1。
Use Package Explorer, not Project Explorer. 使用Package Explorer,而不是Project Explorer。 It's a lot more reliable for Java projects.
它对Java项目来说更可靠。
I've not seen this problem before, but I'd try performing the obligatory clean and build all on the project. 我以前没见过这个问题,但是我会尝试执行强制清理并在项目上构建所有问题。 I suggest making sure the following options are checked in Preferences -> Java -> Compiler -> Building:
我建议确保在Preferences - > Java - > Compiler - > Building中选中以下选项:
There are several good suggestions in the question linked by bdill
, specifically to try updating your project configuration from the pom. 在
bdill
链接的问题中有几个很好的建议,特别是尝试从pom更新项目配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.