roz*_*zky 27
Findbugs jar包含5个XSLT转换,可用于将难以读取的XML转换为易于阅读的HTML,因此我们可以使用xml-maven-plugin插件来执行转换,这里是配置:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<id>findbug</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<findbugsXmlOutputDirectory>
${project.build.directory}/findbugs
</findbugsXmlOutputDirectory>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/findbugs</dir>
<outputDir>${project.build.directory}/findbugs</outputDir>
<stylesheet>fancy-hist.xsl</stylesheet>
<!--<stylesheet>default.xsl</stylesheet>-->
<!--<stylesheet>plain.xsl</stylesheet>-->
<!--<stylesheet>fancy.xsl</stylesheet>-->
<!--<stylesheet>summary.xsl</stylesheet>-->
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
要使报告刚刚执行mvn clean install.
上面的代码片段包含所有5种可能的转换,因此请尝试所有转换,希望您能找到自己喜欢的转换.
我用maven 3和Finbugs 2.0试了一下
看看声纳。它是一个开源、独立的 Web 服务,您可以将代码“提交”到它,它会生成有关各种代码指标的精美 HTML 报告。它还保留构建历史。最重要的是,您不必修改您的构建或 pom!
它也有一个 Maven 目标:sonar:sonar. Jenkins(以前的 Hudson)有一个插件,所以如果你将它用于 CI,那是完全无痛的。
看看吧 - 你不会后悔的!
| 归档时间: |
|
| 查看次数: |
9336 次 |
| 最近记录: |