我使用 findbugs-maven-plugin 来检查 maven 的错误。我的maven项目是一个多模块项目,大致如下:
java-module
pom.xml
src/ ...
pom.xml
scala-module
pom.xml
src/ ...
我使用 Jenkins 来构建和测试项目,Jenkinsfindbugs:findbugs
在最顶层的目录中运行目标。由于 FindBugs 报告了许多由 Scala 编译器生成的代码的虚假警告,我想告诉 FindBugs 不要分析scala-module
. 但是,当我findbugs:findbugs
在最顶层的目录中运行时,它总是分析 和 中的所有java-module
类scala-module
。我怎样才能告诉 mavenscala-module
整体忽略?我知道 FindBugs 排除过滤器,但我会为 FindBugs 提供一个配置选项,告诉它根本不分析某个子模块中的代码。
FindBugspom.xml
在子目录中配置java-module
如下:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${version.plugin.codehaus.findbugs}</version>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
</plugins>
</reporting>
尽管只针对 进行了配置java-module
,FindBugs 也会始终进行分析scala-module
。