为什么 Eclipse 的包浏览器中不再出现错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1751495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:09:33  来源:igfitidea点击:

Why do errors no longer appear in Eclipse's package explorer?

javaeclipseideeclipse-3.5

提问by izb

My project used to be fine - errors showed up in the file margin, the editor breadcrumb, the problems view and in the package explorer tree as little red X marks.

我的项目曾经很好 - 错误出现在文件边距、编辑器面包屑、问题视图和包资源管理器树中,作为小红 X 标记。

Somewhat spontaneously though, it's stopped working properly.

虽然有点自发地,它停止正常工作。

If I introduce an error into my code, it shows up in the file margin, and nowhere else. It takes a 'project clean' to make the red X's show up elsewhere.

如果我在代码中引入错误,它会显示在文件边距中,而不会显示在其他任何地方。需要“清理项目”才能使红色 X 出现在其他地方。

Then if I fix the problem, the error is cleared from the file margin but the red marks persist elsewhere until I do another clean.

然后,如果我解决了问题,错误会从文件边距中清除,但红色标记会在其他地方持续存在,直到我再次进行清理。

Why is it no longer showing errors properly in an automatic way?

为什么它不再以自动方式正确显示错误?

I'm using Eclipse 3.5

我正在使用 Eclipse 3.5

回答by matt b

Did you uncheck Build Automatically?

你取消勾选了Build Automatically吗?

回答by Daniel

I had a similar problem. I imported a project which also uses aspectj. compile errors were shown in the editors, but not in the package/navigator-explorers. And the project was marked as java-project, maven2 and aspectj.

我有一个类似的问题。我导入了一个也使用 aspectj 的项目。编译错误显示在编辑器中,但未显示在包/导航器浏览器中。并且项目被标记为java-project、maven2和aspectj。

Build path seemed ok.(jre was there, maven and aspectj.)

构建路径似乎没问题。(jre 在那里,maven 和 aspectj。)

After long search i found that in the .project file the following entry was missing:

经过长时间的搜索,我发现在 .project 文件中缺少以下条目:

    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>

pasted that in and problem was solved!

粘贴进去,问题就解决了!

回答by J - L

Try fixing your build path, Java compiler, JRE first. If still no luck, You may want to take a look at project Properties-->Builders. Make sure "Java Builder" is there.

首先尝试修复您的构建路径、Java 编译器、JRE。如果仍然没有运气,您可能需要查看项目属性--> Builders。确保“Java Builder”在那里。

回答by Tom Sanders

None of the answers so far applied to my situation, but they steered me towards this solution:

到目前为止,没有一个答案适用于我的情况,但它们引导我走向这个解决方案:

Project -> Properties -> Project Facets -> convert to faceted form...

项目 -> 属性 -> 项目构面 -> 转换为分面形式...

and check the applicable Project Facets.

并检查适用的项目方面。

回答by RTF

Yet another reason for this type of problem: you might not be viewing your project with the correct perspective selected. I recently had this problem with 4 projects in my workspace, 3 of which were PyDev projects and the other was an Android project. In my case, only the Package Explorer was misbehaving, not showing up warnings or errors, but the Problems view and the files themselves wereshowing the errors and warnings.

此类问题的另一个原因是:您可能没有选择正确的视角来查看您的项目。我最近在我的工作区中有 4 个项目遇到了这个问题,其中 3 个是 PyDev 项目,另一个是 Android 项目。在我的情况下,只有在Package Explorer行为不端,没有显示警告或错误,但问题视图和文件本身显示错误和警告。

It turned out that the PyDev perspective was active even while I had the Android project selected. To change perspective, go to Window -> Open Perspective --> [Perspective Name]or alternatively hit the Perspective shortcut button in the top-right corner of Eclipse.

结果表明,即使我选择了 Android 项目,PyDev 透视图也处于活动状态。要更改透视,请转到Window -> Open Perspective --> [Perspective Name]或点击 Eclipse 右上角的透视快捷按钮。

This is relevant to Eclipse Indigo, I can't speak for other versions.

这与 Eclipse Indigo 相关,我不能说其他版本。

回答by Manix

I had a missing project in the buiding dependencies config

我在构建依赖项配置中缺少一个项目

removing it resolve the problem

删除它解决问题