Java Eclipse 问题视图不再显示错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/253357/
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
Eclipse Problems View not showing Errors anymore
提问by will
For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View.
出于某种原因,Eclipse 不再在问题视图中向我显示 Java 编译错误。
It is still showing Warnings.
它仍然显示警告。
This has suddenly happened and I cannot think of anything that I have changed which would affect this.
这突然发生了,我想不出我所做的任何改变会影响到这一点。
I am using the "Maven Integration for Eclipse" plugin but I have been for some time - not sure if this could have affected it or not.
我正在使用“Eclipse 的 Maven 集成”插件,但我已经使用了一段时间 - 不确定这是否会影响它。
Any ideas?
有任何想法吗?
回答by VonC
On Ganymede, check the configuration of the Problem view:
在 Ganymede 上,检查问题视图的配置:
('Configure content') It can be set on 'any element in the same project' and you might currently select an element from the project.
(“配置内容”)它可以设置在“同一项目中的任何元素”上,您当前可能会从项目中选择一个元素。
Or it might be set on a working set, and this working set has been modified
或者它可能设置在一个工作集上,并且这个工作集已经被修改
Make sure that 'Match any configuration' is selected.
确保选择了“匹配任何配置”。
回答by idrosid
At the top right corner of the problems window (next to minimize) there is a small arrow-icon. Click it and select "Configure filters". There is a severity filter that might have been activated.
在问题窗口的右上角(最小化旁边)有一个小箭头图标。单击它并选择“配置过滤器”。有一个严重性过滤器可能已被激活。
回答by Krzysztof Kot
I had same problem and randomly did such things as (several times):
我遇到了同样的问题,随机做了(几次)这样的事情:
1) Project->Clean...,
2) close and open Eclipse again,
3) Run As...
1) Project->Clean...,
2) 关闭并再次打开 Eclipse,
3) Run As...
And it started to work again, without changing configuration.
它再次开始工作,无需更改配置。
回答by Krzysztof Kot
I could reproduce this issue by creating an enumeration with a non-static member class and a static block enumerating its values:
我可以通过使用非静态成员类和枚举其值的静态块创建枚举来重现此问题:
public enum Foo {
Dummy(new Bar [] {new Bar()});
static {
for (Foo foo: Foo.values());
}
private Foo(Bar [] params) {}
public class Bar {}
}
This class breaks the Ganymede compiler. If you delete the line in the static initializer block, the code compiles correctly again, and you get the error that there is no enclosing instance for the new Bar() call, as expected.
这个类破坏了 Ganymede 编译器。如果您删除静态初始化程序块中的行,代码将再次正确编译,并且您会收到错误消息,如预期的那样,没有用于 new Bar() 调用的封闭实例。
-- correction: The above holds only if the project has gaeNature from Google Appengine. However, if you get an error similar as mentioned in the original question, you might be encountering another java compiler bug ...
-- 更正:仅当项目具有来自 Google Appengine 的 gaeNature 时,上述内容才成立。但是,如果您收到与原始问题中提到的类似的错误,您可能会遇到另一个 Java 编译器错误...
回答by Santhanam
I have also faced the same problem.
我也遇到过同样的问题。
After installing m2eclipse plugin, i was not getting any Java compilation errors.
安装 m2eclipse 插件后,我没有收到任何 Java 编译错误。
My solution was to enable dependency management by Select Project -> Right Click (to get context menu) -> m2 Maven -> Enable dependency management.
我的解决方案是通过选择项目 -> 右键单击(获取上下文菜单) -> m2 Maven -> 启用依赖项管理来启用依赖项管理。
Now i am able to view Java Compilation Errors.
现在我可以查看 Java 编译错误。
回答by prea
I have the same problem in slight different situation. I have a parent POM and multiple modules under it. Project was existing and I imported it into eclipse. I can change the "Dependency management" only to parent project but not projects under it. They are not showing any compilation warnings.
我在略有不同的情况下遇到了同样的问题。我有一个父 POM 和它下面的多个模块。项目已存在,我将其导入到 eclipse 中。我只能将“依赖管理”更改为父项目,但不能更改其下的项目。他们没有显示任何编译警告。
Next I'm going to try to change them all into individual projects... that's not what I wanted, but I haven't been able to solve this otherwise...
接下来我将尝试将它们全部更改为单独的项目......这不是我想要的,但我无法解决这个问题......
回答by Justin
I have the same issue with Eclipse Helios and the m2eclipse plugin. They just can't seem to get this thing to work with WTP or WPT or whatever the blasted acronym is.
我对 Eclipse Helios 和 m2eclipse 插件有同样的问题。他们似乎无法让这件事与 WTP 或 WPT 或任何该死的首字母缩写词一起使用。
If I do a clean on the project and watch the Maven console then I can see the compilation issues in the console but eclipse won't touch it. It seems eclipse or WTP/WPT and m2eclipse are busy playing slap hands.
如果我对项目进行清理并观看 Maven 控制台,那么我可以在控制台中看到编译问题,但 eclipse 不会触及它。看来eclipse或者WTP/WPT和m2eclipse都在忙着打巴掌。
回答by Alexander Pogrebnyak
I want to post my story here if Google brings you to this question.
如果谷歌给你带来这个问题,我想在这里发布我的故事。
Somehow, "Project->Build Automatically" got turned off.
不知何故,“项目->自动构建”被关闭了。
Turning it back on produces correct errors list.
重新打开它会产生正确的错误列表。
In my case it has nothing to do with m2e 1.0. This is default behavior for any Java project and goes back as far as Ganymede ( at the point of writing this post I am running Indigo )
就我而言,它与 m2e 1.0 无关。这是任何 Java 项目的默认行为,可以追溯到 Ganymede(在撰写本文时,我正在运行 Indigo)
回答by Psychonaut
I was experiencing this problem as well today. The other solutions presented here (such as cleaning the project and restarting Eclipse) did not work or were not applicable to my setup. What did work for me was right-clicking on the project in the Package Explorer and selecting Maven->Update Project Configuration. Evidently some source folder restructuring I had done the previous day had caused Maven to lose track of things, and issuing this command fixed everything.
我今天也遇到了这个问题。此处介绍的其他解决方案(例如清理项目并重新启动 Eclipse)不起作用或不适用于我的设置。对我有用的是右键单击 Package Explorer 中的项目并选择 Maven->Update Project Configuration。显然,我前一天完成的一些源文件夹重组导致 Maven 失去了对事物的跟踪,并且发出此命令修复了一切。
回答by Kees
I installed and deinstalled ajdt-plugin and got the same problem.
我安装并卸载了 ajdt-plugin 并遇到了同样的问题。
Check <Project><Properties><Builders>
.
It should have a 'Java Builder'.
检查<Project><Properties><Builders>
。它应该有一个“Java Builder”。
This code should be in the .project file (file is in the root of your project):
此代码应位于 .project 文件中(文件位于项目的根目录中):
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>