Android in Hudson (3) 加入findbugs分析

Android in Hudson (3) 加入findbugs分析

findbug其實跟Android預設的行為沒有關係,因此只要按照其官方文件的寫法加入project的build.xml中即可

 

	<property name="findbugs.home" value="path to your findbugs" />
<path id="fundbugs_lib">
        <pathelement location="${findbugs.home}/lib/findbugs-ant.jar"/>
      <pathelement location="${findbugs.home}/lib/findbugs.jar"/>
      <pathelement location="${findbugs.home}/lib/annotations.jar"/>
      <pathelement location="${findbugs.home}/lib/ant.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-analysis-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-commons-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-tree-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-util-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/asm-xml-3.1.jar"/>
      <pathelement location="${findbugs.home}/lib/bcel.jar"/>
      <pathelement location="${findbugs.home}/lib/commons-lang-2.4.jar"/>
      <pathelement location="${findbugs.home}/lib/dom4j-1.6.1.jar"/>
      <pathelement location="${findbugs.home}/lib/jaxen-1.1.1.jar"/>
      <pathelement location="${findbugs.home}/lib/jFormatString.jar"/>
      <pathelement location="${findbugs.home}/lib/jsr305.jar"/>
   </path>
   
   <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="fundbugs_lib" />
   
   <target name="findbugs" >
      <findbugs home="${findbugs.home}"
                 output="xml:withMessages"
                 outputFile="findbugs.xml"
               jvmargs="-Xss1m -Xmx800m" >
         <sourcePath path="src" />
         <class location="bin/classes" />
      </findbugs>
   </target>   

 

請注意!在執行findbugs的target之前,必須先compile專案!
參考:http://findbugs.sourceforge.net/manual/anttask.html

 

注意:target定義需在<setup />後,taskdef與property等需在<setup />前