spotbugs与maven集成,实现maven package打包前校验

      <plugin>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs-maven-plugin</artifactId>
                            <version>4.8.4.0</version>
                            <executions>
                                <!--package时执行spotbugs检测-->
                                <execution>
                                    <id>spotbugs-check</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>check</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                         		<!--校验开关-->
                                <failOnError>true</failOnError>
                                <!--校验级别-->
                                <xmlOutput>true</xmlOutput>
                                <htmlOutput>true</htmlOutput>
                            </configuration>
                            <dependencies>
                                <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
                                <dependency>
                                    <groupId>com.github.spotbugs</groupId>
                                    <artifactId>spotbugs</artifactId>
                                    <version>4.8.4</version>
                                </dependency>
                            </dependencies>
                        </plugin>

如果打包失败,有不符合代码规范处,可以看target下的spotbugs.html,此html页面不好看,所以推荐使用maven spotbugs:GUI查看详细页面,spotBugs提供的GUI很直观,类似于sonar页面

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值