我之前使用过 FindBugs 并且没有遇到任何问题,但是这次在 Ubuntu Natty Narval 上的 Eclipse Helios 上发现了但未显示的错误。
这是我尝试过的:
- 右键点击项目>查找Bugs>查找Bugs
- 看进度发现发现了3个bug
- 在“问题” View 中未列出它们
我尝试通过以下方式进入自己的视角:Open Perspective > Other > FindBugs but Bug Explorer is empty.
有什么想法可以查看这些错误吗?
更新:在 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,但我找到了解决方法。我在 maven 的 pom.xml 中添加了 findbugs 报告
<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 报告
最佳答案
如果您在某些项目中出现了错误,而在其他项目中却没有,则问题可能是某个项目中的错误不够严重而无法显示。
我遇到了同样的问题(在编辑器中打开分析结果中显示了 30 个错误),但在问题 View 或查找错误资源管理器中没有。以下对我有用:
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
关于java - FindBugs 未显示找到的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6395546/