如何使用Maven 3.x为findbugs生成html报告 [英] How to generate a html report for findbugs with Maven 3.x

查看:351
本文介绍了如何使用Maven 3.x为findbugs生成html报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人设法配置findbugs Maven 3.x插件以生成xml和html报告? (我要让Jenkins使用xml,而要在提交之前进行检查的是html)

Has anybody managed to configure the findbugs Maven 3.x plugin to produce both an xml and html report? (I want the xml one for Jenkins and the html one for checking prior to a commit)

我在网上看到了很多有关设置的文档,但是其中大多数似乎是用于Maven 2.x,我知道它的配置有所不同(令人讨厌的是2. x配置被3.x静默忽略).我是Maven的新手,所以我不确定自己是在做错什么还是遵循旧的说明.

I've seen a lot of documentation on the web on setting this up, but most of it appears to be for Maven 2.x, which I know is configured differently (annoyingly the 2.x configuration is silently ignored by 3.x). I'm new to Maven, so I'm not sure if I'm doing something wrong or I'm following old instructions.

我的pom包含以下内容:

My pom contains the following:

</build>
    </plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.3.3</version>
            <configuration>
                <!-- findbugs:help -Ddetail=true  for outputDirectory:
                     Location where generated html will be created. 
                 -->
                <outputDirectory>${project.build.directory}/findbugs</outputDirectory>

                <xmlOutput>true</xmlOutput>
                <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                <xmlOutputDirectory>target/findbugs</xmlOutputDirectory>
                <failOnError>false</failOnError>
            </configuration>
        </plugin>
    </plugins>
</build>

推荐答案

Findbugs-Plugin应该位于reportPlugins- maven-site-plugin的一部分中.

The Findbugs-Plugin should be in the reportPlugins-Part of the maven-site-plugin.

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-site-plugin</artifactId>
      <configuration>
        <reportPlugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
          </plugin>
        </reportPlugins>
      </configuration>
    </plugin>
  </plugins>
</build>

此外,仅在运行mvn site之前编译源代码时才生成findbugs-report.生成站点时,我使用mvn test site,因此findbugs会生成报告.

And additionally, findbugs-report is only generated when the source is compiled before running mvn site. When generate the site, i use mvn test site so findbugs generate the report.

这篇关于如何使用Maven 3.x为findbugs生成html报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆