Use the FindBugs plug-in to scan your code and generate reports using Ant

Source: Internet
Author: User

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



Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.