【发布时间】:2012-08-08 06:48:08
【问题描述】:
我需要一些帮助来设置 maven 项目的代码质量插件。
我有一个多模块项目。虽然我在构建过程中配置了 pmd、checkstyle、findbugs 和 cobertura,并且可以为每个插件生成 xml 报告,但我在项目中配置声纳插件时面临一些挑战。
我不知道如何解决这个问题:
- 我应该在执行声纳时重复使用这些插件生成的报告吗?如果是这样,我的声纳插件配置应该是什么?
- 如果我使用嵌入的
pmd、checkstyle、findbugs和cobertura插件运行声纳,如何将它们配置为仅针对特定包运行或使findbugs分析com.mycompany.-结构。 - 最后,我无法在声纳中获得覆盖报告,无论是在声纳外部还是在声纳内运行 cobertura。
我在下面有我的 pom 供审核。任何帮助将不胜感激。
这是在我的根 pom 中构建部分的插件部分:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<instrumentation>
<includes>
<include>com/mycompany/**/*.class</include>
</includes>
</instrumentation>
<formats>
<format>xml</format>
</formats>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
<configuration>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.6</targetJdk>
<includes>
<include>com/mycompany/**/*.java</include>
</includes>
<excludeRoots>
<excludeRoot>target/generated-sources/*</excludeRoot>
</excludeRoots>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<onlyAnalyze>com.mycompany.-</onlyAnalyze>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<includes>com/mycompany/**/*.java</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
【问题讨论】:
标签: maven sonarqube findbugs checkstyle cobertura