checkstyle+ ant bulid.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="style" default="xml2html" basedir=".">
    
    <property name="project.name" value="SpringMvc3" />
    <property name="project.dir" value="E:\software\tools\eclipse\workspace\SpringMvc3\" />
    <property name="project.src.dir" value="${project.dir}\src\main\java" />
    <property name="project.report.dir" value="${project.dir}\src\report" />
    <property name="project.result.dir" value="${project.dir}\src\report"/>
    
    <target name="init">
        <mkdir dir="${project.report.dir}"/>
    </target>

    <target name="checkstyle" depends="init">
        <taskdef resource="checkstyletask.properties" classpath="checkstyle-5.6-all.jar"/> 
        <checkstyle  
            failOnViolation="false"    
            failureProperty="checkstyle.failed"
            config="checkStyle_usually.xml">
            <fileset dir="${project.src.dir}" includes="**/*.java"/>    
            <formatter type="plain"/>    
            <formatter type="xml" toFile="${project.result.dir}\checkstyle_report.xml"/>    
        </checkstyle>
    </target>
    
    <target name="xml2html" depends="checkstyle">
        <xslt in="${project.result.dir}\checkstyle_report.xml" out="${project.report.dir}/checkstyle_report.html" style="contrib\checkstyle-simple.xsl">    
        </xslt>    
    </target>
</project>

你可能感兴趣的:(ant,bulid.xml)