首先,下载findbug插件,解压到eclipse的plugin目录下。
下载地址:http://download.youkuaiyun.com/download/qq_29463709/10162960
修改build.xml文件中第二行的value值
<project name="DHOME_ANDRIOD_CodeCheck" default="findbugs">
<property name ="findbugs.home" value ="E:\eclipse(jdk1.7)\eclipse\plugins\edu.umd.cs.findbugs.plugin.eclipse_3.0.1.20150306-5afe4d1"/>
<path id="findbugs.lib">
<fileset dir ="${findbugs.home}/lib">
<include name ="findbugs-ant.jar"/>
</fileset>
</path>
<taskdef name="findbugs" classpathref ="findbugs.lib" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"></taskdef>
<target name ="findbugs">
<findbugs home ="${findbugs.home}" jvmargs="-Xmx884m" output ="html" outputFile ="D:/findbugs.html">
<class location ="target/classes"/>
<auxClasspath path="${findbugs.home}/lib/findbugs-ant.jar"/>
<auxClasspath>
</auxClasspath>
<sourcePath path ="src"/>
</findbugs>
</target>
</project>
将bulid.xml文件放到项目的src目录下,进入eclipse中选择该文件run as ant bulid,产生的html报告默认在d盘。