1. Download checkstyle zip file, unZip it.(I use 5.3)
2. The ant build file, e.g.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Checkstyle" basedir=".">
<target name="checkstyle">
<taskdef resource="checkstyletask.properties" classpath="C:\tools\checkstyle-5.3\checkstyle-5.3-all.jar"/>
<checkstyle config="C:\tools\CheckStyle_config.xml" classpath="C:\tools\checkstyle-5.3-all.jar">
<formatter type="xml" tofile="checkstyle-result.xml"/>
<fileset dir="....\src" includes="**/*.java"/>
</checkstyle>
</target>
</project>
-- classpath: the path of "check-5.3-all.jar", it is in the checkstyle folder
-- checkstyle config: this file is your checkstyle rule file
-- tofile: to set the output report file, xml format file can be analyzed by Hudson
-- fileset dir: to set which code you want to analyze.
3. Then you can use the ant build file in your hudson jobs.
浙公网安备 33010602011771号