之前我曾经使用过FindBugs而且我没有遇到任何问题,但是这次在Eclipse Helios上发现了Ubuntu Natty Narval错误但未显示。
这是我试过的:
我尝试用自己的观点:Open Perspective>其他> FindBugs但Bug Explorer是空的。
查看这些错误的想法?
更新:在Eclipse错误日志中,我看到:
!ENTRY edu.umd.cs.findbugs.plugin.eclipse 2 2 2011-06-18 21:13:24.968
!MESSAGE The following classes needed for FindBugs analysis on project **
were missing:
!SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
!MESSAGE org.apache.commons.exec.CommandLine
!SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
!MESSAGE org.apache.commons.exec.DefaultExecutor
!SUBENTRY 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2011-06-18 21:13:24.969
!MESSAGE org.apache.commons.exec.ExecuteException
更新2:我不知道如何修复Eclipse,但我找到了解决方法。我将findbugs报告添加到maven的pom.xml
<reporting>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.3-SNAPSHOT</version>
<configuration>
<xmlOutput>true</xmlOutput>
<!-- Optional derectory to put findbugs xdoc xml report -->
<xmlOutputDirectory>target/site</xmlOutputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
以下配置在target / site / findbugs.html
中生成HTML报告答案 0 :(得分:58)
如果您在某些项目中出现错误而在其他项目中出现错误,则问题可能是某个项目中的错误不足以显示出来。
我遇到了同样的问题(编辑器中的Open Analysis Results中显示了30个错误)但在Problems视图或Find Bugs Explorer中没有。以下对我有用:
1. Project -> Properties -> Find Bugs
2. Enable Project Specific Settings
3. Check everything under Report Visible Bug Categories
4. Slide minium rank to report to 20
5. Set minimum confidence to Low
6. Rerun FindBugs
答案 1 :(得分:4)
这可能是您的问题视图配置的问题。执行以下步骤以确保在问题视图中显示findbugs结果:
现在问题视图应该显示之前的3个发现。
或者,您可以使用Findbugs透视图深入了解发现的问题。
我在Findbugs Eclipse插件页面找到了一个额外的条目:Eclipse Plugin loads, but does not work correctly。检查一下。
当Findbugs尝试分析您的类(而不是源代码)时,您的代码所使用的类必须可用。我不知道哪些错误模式是必要的,但对于某些(流程分析),使用的类必须是可达的。因此,请确保在eclipse的加载路径中可以看到所使用的类(直接或间接)。
答案 2 :(得分:1)
我在使用maven,eclipse和m2e-code-quality插件(https://github.com/m2e-code-quality/m2e-code-quality)时遇到了类似的问题。解决方案是列出应该在findbugs-maven-plugin配置中的访问者标记中运行的所有访问者。此外,您可能希望将maxRank设置为20.当您省略运行m2e-code-quality插件的访问者时,将生成一个findbugs插件配置,该配置根本不运行任何访问者。最糟糕的是,项目属性中的findbug设置将显示一些已启用的访问者,但这些不是来自项目配置。