Maven execute a goal on build fail / FindBugs

自古美人都是妖i 提交于 2019-12-04 12:17:53
Enigo

Special thanks to @SpaceTrucker for workaround suggestion. Here is the configuration I ended up with:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>findbugs-maven-plugin</artifactId>
   <version>3.0.4</version>
   <configuration>
       <effort>Max</effort>
       <threshold>Low</threshold>
       <findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory>
   </configuration>
   <executions>
       <execution>
           <id>noFailOnError</id>
           <phase>verify</phase>
           <goals>
               <goal>check</goal>
           </goals>
           <configuration>
               <failOnError>false</failOnError>
           </configuration>
       </execution>
       <execution>
           <id>failOnError</id>
           <phase>install</phase>
           <goals>
               <goal>check</goal>
           </goals>
           <configuration>
               <failOnError>true</failOnError>
           </configuration>
       </execution>
   </executions>
</plugin> 

The solution is to use different configurations in verify and install phases. Note, that according to that answer transformation (to html) is executed in verifyphase.

Issue was submitted for html report generation.

Results are also can be seen by simply run mvn findbugs:gui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!