Tags

,

In my earlier post, I mentioned use of Checkstyle for Java (https://twentymegahertz.wordpress.com/2012/10/20/checkstyle-for-java-projects/) – a tool that can be used to ensure that code follows a certain style. On going through the post, I realized that the post ends abruptly. While I remember clearly that I had included the corresponding Ant build.xml entry, that part of the post is missing.

Hence I am including that entry here.

<property name="checkstyle.home" value="d:/soft/checkstyle-5/"/>
<property name="checkstyle.jar" value="checkstyle-all-5.jar"/>

<taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/${checkstyle.jar}"/>

<target name="checkstyle" description="Generates a report of code convention violations.">
  <checkstyle config="${checkstyle.home}/checkstyle.xml"
    failureProperty="checkstyle.failure"
    failOnViolation="false">
    <formatter type="xml" tofile="checkstyle_report.xml"/>
    <fileset dir="src" includes="**/*.java"/>
  </checkstyle>

  <style in="checkstyle_report.xml" out="checkstyle_report.html" style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
</target>
Advertisements