Example script for running FindBugs. This script can be used for Continuous Integration like Jenkins.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Description :ANT script for FindBugs. -->
<project default="findbugs.script" name="CIT FindBugs">
<!-- Default target -->
<target name="findbugs.execute" depends="findbugs.exec" />
<!-- Property -->
<property name="checkout.project.dir" value="C:/Program Files (x86)/Jenkins/jobs"/>
<property name="findbugs.reports.dir" value="C:/reports"/>
<property name="findbugs.home" value="C:/findbugs-1.3.9-rc1"/>
<!-- FindBugs TaskDef -->
<taskdef name="findbugs" classpath="${findbugs.home}/lib/findbugs.jar" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<!-- Run Findbugs -->
<target name="findbugs.exec" description="target :project.cit">
<echo>[START] :Execute FindBugs</echo>
<tstamp>
<format property="init_time" pattern="yyyy.MMM.dd ':' HH:mm:ss z" locale="en"/>
<format property="ext_time" pattern="yyyyMMMddHHmmss" locale="en"/>
</tstamp>
<move failonerror="false" file="${findbugs.reports.dir}/findbugs.html" tofile="${findbugs.reports.dir}/archives/findbugs_${ext_time}.html"/>
<echo> Time now is ${init_time}</echo>
<echo> Ext time is ${ext_time}</echo>
<findbugs home="${findbugs.home}" workHard="true" output="html" outputFile="${findbugs.reports.dir}/findbugs.html" failOnError="true" errorProperty="findbugsFailure" effort="min" reportLevel="low" jvmargs="-Xmx1024M">
<sourcePath path="${checkout.project.dir}/workspace/src/**.java" />
<class location="${checkout.project.dir}/workspace/bin" />
</findbugs>
<echo>[END] :Finished running FindBugs</echo>
</target>
</project>
No comments:
Post a Comment