SpotBugs(一):使用简介

前言

此文件将介绍在IDEA中使用SpotBugs的配置

一、SpotBugs是什么?

官方:https://spotbugs.github.io/

主要用途就是用来查找Java代码中的错误的程序,让我们的编码更加规范.

二、使用步骤

1.引入SpotBugs插件

代码如下(示例):

<build>
	<plugin>
	  <groupId>com.github.spotbugs</groupId>
	  <artifactId>spotbugs-maven-plugin</artifactId>
	  <version>4.5.3.0</version>
	  <executions>
	      <execution>
	          <id>check</id>
	          <phase>package</phase>
	          <goals>
	              <goal>check</goal>
	          </goals>
	      </execution>
	  </executions>
	  <dependencies>
	      <dependency>
	          <groupId>com.github.spotbugs</groupId>
	          <artifactId>spotbugs-annotations</artifactId>
	          <version>4.6.0</version>
	      </dependency>
	  </dependencies>
	</plugin>
</build>

2.使用Maven Helper插件

这里是我为了更加方便的执行maven打包等操作,也可以不安装
在这里插入图片描述
右键项目,添加命令:spotbugs:gui
这样就可以通过spotbugs提供的工具来图形化解析到时产生的xml报告
在这里插入图片描述

3.不使用使用Maven Helper插件

可以在idea的terminal中执行
在这里插入图片描述


结果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值