checkstyle,findbugs,pmd
点击(此处)折叠或打开
- ?xml version="1.0"?>
- project name="test" basedir="." default="findbugs">
- taskdef resource="checkstyletask.properties" classpath="C:/checkstyle-5.5/checkstyle-5.5-all.jar"/>
- taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
- property name="findbugs.home" value="C:/findbugs-2.0.1-rc2" />
- target name="findbugs" depends="checkstyle,build,pmd">
- findbugs home="${findbugs.home}" output="xml" outputFile="findbugs.xml" >
- auxClasspath path="${basedir}/bin" />
- sourcePath path="${basedir}/src" />
- class location="${basedir}/bin" />
- /findbugs>
- /target>
- target name="init">
- delete dir="${basedir}/bin" />
- mkdir dir="${basedir}/bin" />
- /target>
- target name="build" description="Build Source Java File" depends="init">
- javac srcdir="${basedir}/src" destdir="${basedir}/bin" target="1.6" encoding="UTF8"/>
- /target>
- target name="checkstyle" description="Generates a report of code convention violations.">
- checkstyle config="c:/MyCheckStyle-1.4.xml"
- failureProperty="checkstyle.failure"
- failOnViolation="false">
- formatter type="xml" tofile="checkstyle_result.xml"/>
- fileset dir="src" includes="**/*.java"/>
- /checkstyle>
- !--style in="checkstyle_result.xml" out="checkstyle_result.html" style="C:/checkstyle-5.5/contrib/checkstyle-frames.xsl"/>-->
- /target>
- !-- run this target as part of automated build -->
- target name="checkstyle-nightly"
- depends="checkstyle"
- if="checkstyle.failure"
- description="Sends email if checkstyle detected code conventions violations.">
- !-- use your own server and email addresses below. See Ant documentation for details -->
- mail from="qa@some.domain"
- tolist="someone@some.domain,someoneelse@some.domain"
- mailhost="mailbox.some.domain"
- subject="Checkstyle violation(s) in project ${ant.project.name}"
- files="checkstyle_report.html"/>
- /target>
- path id="pmd.classpath">
- pathelement location="${build}"/>
- fileset dir="C:\pmd-bin-5.0.0\lib">
- include name="*.jar"/>
- /fileset>
- /path>
- taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
- target name="pmd">
- pmd rulesetfiles="rulesets/java/design.xml">
- formatter type="xml" toFile="${basedir}\pmd_report.xml"/>
- fileset dir="${basedir}\src">
- include name="**/*.java"/>
- /fileset>
- /pmd>
- /target>
- /project>