简体   繁体   English

在使用Maven时,如何解决在Eclipse中显示但不在Eclipse中显示项目的编译错误?

[英]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和M​​aven 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中选中以下选项:

  • Scrub output folders when cleaning projects 清理项目时清理输出文件夹
  • Rebuild class files modified by others 重建其他人修改的类文件

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.

相关问题 在Eclipse中使用Maven时,如何在问题窗格中显示编译器错误? - How to show compiler errors in problems pane when using Maven in Eclipse? 如何解决这些Maven内部错误? - How do I resolve these Maven internal errors? 如何让maven显示所有编译错误 - How to get maven to show all compilation errors 如何在Eclipse中的两个Android项目之间共享类? - How do I share classes between two Android projects in Eclipse? 在Eclipse中解析Maven依赖项的类 - Resolve classes of maven dependencies in eclipse 使用Gradle或Maven时Eclipse构建错误? - Eclipse build errors when using Gradle or Maven? 我如何在不使用SBT和play框架编译或忽略编译错误的情况下生成eclipse项目? - Ho do I generate eclipse project without compiling or ignoring compilation errors using SBT and play framework? 使用Maven整合2个Eclipse项目 - Integrate 2 eclipse projects using maven 如果我有2个Maven项目而一个需要另一个作为库,我该如何避免在Eclipse中进行多余的“ maven更新” - How do i avoid the redundant “maven-update” in eclipse if i have 2 maven projects while one needs the other as a library 如何(手动)在 Maven/Java 项目中禁用 Eclipse jdt.ls 编译 - How to (manually) disable Eclipse jdt.ls compilation in Maven/Java projects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM