12 Eylül 2011 Pazartesi

findbugs ant task

Findbugs is a static analysis tool that finds existing bugs in java code. Here is a link on how to use it from ant script: http://findbugs.sourceforge.net/manual/anttask.html

and code sample is as follows:



<property name="findbugs.home" value="/home/hilal.tarakci/Desktop/htarakci/environment/other/findbugs-1.3.9"/>
<target name="findbugs-define">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath path="${findbugs.home}/lib/findbugs.jar" />
</taskdef>
<!-- ensure that findbugs taskdef is only run once, otw ant will error -->
<property name="findbugs.initialized" value="true" />
</target>
<target name="findbugs" if="findbugs.present" depends="findbugs-define, jar" description="Run findbugs">
<findbugs output="xml:withMessages" home="${findbugs.home}" effort="max" outputFile="${build.dir}/findbugs.report.xml">
<auxClasspath>
<fileset dir="${ivy.lib}">
<include name="**/*.jar" />
<exclude name="**/ivy-*.jar" />
</fileset>
</auxClasspath>
<sourcePath path="${src.dir}" />
<class location="${build.dir}/${final.name}.jar" />
</findbugs>
<xslt style="${findbugs.home}/src/xsl/fancy-hist.xsl" in="${build.dir}/findbugs.report.xml" out="${build.dir}/findbugs.report.html" />
</target>


Hiç yorum yok:

Yorum Gönder