Recent projects are using the FindBugs plug-in to generate reports, summarizing usage and how to generate reports
1, the download of the compression package after decompression, the
Copy to eclipse's plugin directory; 2, restart Eclipse 3, open eclipse->window->preferences, search for keyword findbugs, if you can find a configuration entry, then the installation is successful, As shown in figure:
how to use. findbugs simple and easy to use, according to the following figure operation can be; 1, in Eclipse package Explorer right-click to select Target Project-> build project
2, select the specified package or class for Findbug
At this point FindBugs will walk through the specified package or class, analyze it, find the code bug, and then focus on the Bugs Explorer, found bugs, and add Bugs Explorer below. 3, add findbugs Explorer
(Eclipse in the lower left corner)
3, after the Bugs Explorer is added, we can view the bugs that we just found, as shown in the figure:
The bug found is 3 in color, black bug mark is classified, red bug indicates that the bug has to be modified after the serious bugs are discovered, and the orange bug indicates the potential warning bug to revise as far as possible. (appendix is a variety of bugs to explain and modify the program, please refer to the schedule to revise) double-click the bug item to automatically open the relevant code file in the right edit window and connect to the code fragment. Clicking on the little bug icon next to the line number and then eclipse the output below will provide detailed bug descriptions, as well as changes to recommendations. We can make changes based on this information. How to generate a report.
1. Download Findbugs-3.0.1.zip
2. Unzip the Findbugs.jar and Findbugs-ant.jar inside the eclipse's plugin directory as my "D:\KAIFA\eclipse3\links\plugins\ Edu.umd.cs.findbugs.plugin.eclipse_3.0.1.20150306-5afe4d1\lib "
Writing build.xml files
<project name= "findBugs" default= "findBugs" >
<property name = "Findbugs.home"
value = "D:\KAIFA\" Eclipse3\links\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 = "Classes"/>
<auxclasspath path= "${findbugs.home}/lib/findbugs-ant.jar"/>
< auxclasspath>
</auxClasspath>
<sourcepath path = "src"/>
</findbugs>
</target>
</project>
Description
Findbugs.home is the path of the downloaded FindBugs plugin
Findbugs.lib is findbugs run dependent jar Package storage path (to Findbugs.jar and Findbugs-ant.jar) to the Lib directory of the FindBugs plug-in
taskdef define ant task, name is Ant task, classpathref only want jar package path
The target specific ant task outputs the format of the specified output. class specifies the path to be checked by the code (because FindBugs is the. class file that is checked, so just the path to the compiled class file), Auxclasspath is the jar package that FindBugs relies on but does not want to check SourcePath Specify source code path
after this setting, directly right-click the Build.xml file and select Ant build to generate an HTML code Check report