Java 当使用findBug插件发现bug时,如何使maven构建失败
我刚刚在我的项目pom中添加了maven find bug插件:Java 当使用findBug插件发现bug时,如何使maven构建失败,java,maven,maven-3,maven-plugin,findbugs,Java,Maven,Maven 3,Maven Plugin,Findbugs,我刚刚在我的项目pom中添加了maven find bug插件: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>3.0.4</version> <confi
<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>
它显示有12个bug作为警告,并且构建成功
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------------
----------
当发现任何针对findbug插件的警告时,我想让构建失败,并将此警告显示为错误。
我已经通过插件,但没有什么关于它。
请提供帮助。将您的配置编辑为:
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>findbugs</goal>
</goals>
<configuration>
<failOnError>true</failOnError>
<threshold>High</threshold>
</configuration>
</execution>
</executions>
包裹
芬德布格斯
真的
高
希望它能帮助你 您可以简单地使用
检查带有标记的目标,并将其设置为false,以避免构建失败
<plugin>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<effort>Max</effort>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<groupId>org.codehaus.mojo</groupId>
<version>3.0.5</version>
</plugin>
findbugs maven插件
马克斯
假的
检查
org.codehaus.mojo
3.0.5
不,没有。当我尝试失败错误和阈值时,它给了我构建成功的机会。你试过了吗?成功了。当目标变为检查时
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>findbugs</goal>
</goals>
<configuration>
<failOnError>true</failOnError>
<threshold>High</threshold>
</configuration>
</execution>
</executions>
<plugin>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<effort>Max</effort>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<groupId>org.codehaus.mojo</groupId>
<version>3.0.5</version>
</plugin>