Integrating Ant and Checkstyle

0
Share this on .. Tweet about this on Twitter0Share on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on TumblrBuffer this page

The Open Source Java code checker Checkstyle can be easily used by Ant to check your Java code.

This is an excerpt from an Ant build.xml file using the Sun Java coding checks:

   <property name="checkstyle.home" location="..."/>
   <taskdef resource="checkstyletask.properties" classpath="${checkstyle.home}/checkstyle-all-3.5.jar"/>
   <target name="checkstyle">
     <checkstyle config="${checkstyle.home}/sun_checks.xml" failOnViolation="false" classpathref="classpath">
       <fileset dir="${src.dir}" includes="**/*.java"/>
     </checkstyle>
   </target>

See also the manual of Checkstyle. Please note that JDeveloper has Audit Rules for Java code, but I do not know how to check those Rules with Ant.

Share this on .. Tweet about this on Twitter0Share on LinkedIn0Share on Facebook0Share on Google+0Email this to someoneShare on TumblrBuffer this page

About Author

Oracle Consultant at AMIS

Comments are closed.