简体   繁体   English

FindBugs和Maven

[英]FindBugs and Maven

I would like Maven to generate a FindBugs report where the bugs are grouped by severity, not by file. 我希望Maven生成一个FindBugs报告,其中错误按严重性而不是文件分组。 Then I would be able to focus on the most serious bugs immediately. 这样我就可以立即专注于最严重的错误。 I have seen similar functionality with the FindBugs plugin for Eclipse. 我已经在Eclipse的FindBugs插件中看到了类似的功能。 Is this possible with Maven? Maven有可能吗?

You should also have a look at Sonar . 您还应该看看Sonar Its dashboard reports data generated by many code analysers like Findbugs, Checkstyle or Cobertura. 它的仪表板报告由许多代码分析器(如Findbugs,Checkstyle或Cobertura)生成的数据。 It's really quick and easy to navigate in measures like Findbugs bugs. 使用诸如Findbugs错误之类的措施导航非常容易。 Of course it's possible to filter data by severity (see the page "violations drilldown"). 当然,可以按严重性过滤数据(请参见“违规细化”页面)。 The release 1.9 only supports two levels of severity (mandatory/optional) but next version will define five levels from info to blocker. 1.9版仅支持两个级别的严重性(强制/可选),但下一版本将定义从信息到阻止程序的五个级别。 It should be released next week. 它应该在下周发布。

To answer you amended question, the findbugs-maven-plugin does not currently offer a way to sort bugs via severity. 为了回答您提出的问题,findbugs-maven-plugin当前不提供通过严重性对错误进行排序的方法。 I would suggest you log an enhancement request to the project. 我建议您将增强请求记录到项目中。

-- What follows is my answer to the original question, which simply asked if there was a FindBugs Maven plugin. - 以下是我对原始问题的回答,该问题只是询问是否有FindBugs Maven插件。 The question has since changed and is answered above. 此后此问题已更改,并已在上面回答。 -- -

Yes, there is a findbugs-maven-plugin . 是的,有一个findbugs-maven-plugin Add this plugin to the reporting section of your POM and run mvn clean site to see the report. 将此插件添加到POM的报告部分,然后运行mvn clean site以查看报告。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>2.1</version>
    <configuration>
        <effort>Max</effort>
    </configuration>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM