Checkstyle + ANT

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Checkstyle + ANT

ebruner
This post has NOT been accepted by the mailing list yet.
Could someone cut & paste an entire working ANT script configured to call checkstyle? I'm trying to follow: this page, but I'm not having much success. What I see on that page are the important fragments, but I'd like to see it all together. I'm using ANT 1.8 and CS 5.5. What environment variables need to be set? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Checkstyle + ANT

ebruner
This post has NOT been accepted by the mailing list yet.
This post was updated on .
This is the ant script I have:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<project name="ccu" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">

<taskdef resource="checkstyletask.properties">
        <classpath>
                <pathelement location="\bin"/> 
                <pathelement location="C:\ant\lib\checkstyle-5.5-all.jar"/> 
        </classpath>
</taskdef>

<checkstyle config="custom_check.xml">

  <fileset dir="src" includes="**/*.java"/>
 
</checkstyle>

</project>

This ANT script runs, but it gives me this error:
C:\ant.xml:15: Unable to create a Checker: cannot initialize module TreeWalker - Unable to instantiate com.lm.check.BreakToLabel

running ANT with -debug: verifies that ANT is finding the correct checkstyle jar.  Also, there are messages "Finding class com.lm.check.BreakToLabel".  If it finds it, why can't it run it?  From searching around, a lot of people say that this is a CLASSPATH problem.  My %CLASSPATH% is empty.  The CLASSPATH is only defined in this script.  What's the problem?

It runs fine from the command line.  It runs fine with ANT using sun_checks.xml.