Maven 版本:3.3.3。 Findbugs插件版本:3.0.1
-
我正在使用findbugs-maven-plugin
我需要运行 findbugs
src 和测试类上的插件。目前仅适用于源类
Target
|_ classes
|_ test-classes
|_ findbugs (only have results regarding classes folder)
我需要对 PMD 插件执行相同的操作。也许同样的提示?
相关问题:
- 用于忽略 JUnit 测试的 FindBugs 过滤器文件
- 如何在测试代码上运行 findbug
Findbugs maven 配置:
<profile>
<id>findbugs</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.version}</version>
<configuration>
<effort>Max</effort>
<failOnError>true</failOnError>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
<includeTests>true</includeTests>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
<executions>
<execution>
<id>analyze-compile</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
在配置中findbugs-maven-plugin
,您需要显式设置includeTests元素到true
FindBugs 分析测试类:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<!-- rest of configuration -->
<includeTests>true</includeTests>
</configuration>
</plugin>
此外,该插件应该绑定到verify
阶段,以便 FindBugs 在编译源类和测试类之后执行。
For the maven-pmd-plugin
,它实际上是相同的:元素includeTests必须设置为true
在插件配置中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)