Joh*_*tin 3 java findbugs maven-plugin maven-3 maven
我刚刚在项目pom中添加了maven find bug插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
<configuration>
<xmlOutput>true</xmlOutput>
<!-- Optional directory to put findbugs xdoc xml report -->
<xmlOutputDirectory>target/site</xmlOutputDirectory>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
为了报告,我在下面添加了:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在,当我使用install运行maven时,会在以下警告我:
> [INFO] --- findbugs-maven-plugin:3.0.4:findbugs (default) @
> MovesouqBackend --- [INFO] Fork Value is true
> [java] Warnings generated: 12 [INFO] Done FindBugs Analysis....
Run Code Online (Sandbox Code Playgroud)
它显示有12个错误作为警告并成功建立。
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------
----------
Run Code Online (Sandbox Code Playgroud)
当发现针对findbug插件的任何警告时,我想使构建失败,并且我希望将此警告显示为错误。我已经阅读了插件文档,但与此无关。请帮忙。
小智 5
将配置编辑为:
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>findbugs</goal>
</goals>
<configuration>
<failOnError>true</failOnError>
<threshold>High</threshold>
</configuration>
</execution>
</executions>
Run Code Online (Sandbox Code Playgroud)
希望对您有帮助!