Re: problems calling checkstyle from ANT
Oliver Burn <[email protected]> Wed, 29 Apr 2009 11:24:48 +1000
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
Try:
<taskdef resource="checkstyletask.properties"
classpath="${CHECKSTYLE_HOME}/checkstyle-all-5.0.jar"
/>
On Wed, Apr 29, 2009 at 11:17, Jackson Ha <[email protected]> wrote:
> Hi,
>
> I'm currently using checkstyle 5.0 and ANT 1.7.0. I'm having trouble with
> defining the checkstyle task in ANT. It seems like it can't find the jar on
> the classpath? I even tried puting the checkstyle-all-5.0.jar into the
> ANT_HOME/lib, but that didnt' help either.
>
> Does anyone have any recommendations?
>
> Thanks!
> J
>
> I end up with this error
>
> C:\dev\hudson\jobs\HelloWorld\workspace\HelloWorld>ant -f
> build-checkstyle.xml
> Buildfile: build-checkstyle.xml
> checkstyle:
> BUILD FAILED
> C:\dev\hudson\jobs\HelloWorld\workspace\HelloWorld\build-checkstyle.xml:25:
> Prob
> lem: failed to create task or type checkstyle
> Cause: The name is undefined.
> Action: Check the spelling.
> Action: Check that any custom tasks/types have been declared.
> Action: Check that any <presetdef>/<macrodef> declarations have taken
> place.
>
> This is my build file:
>
> <project basedir="." default="checkstyle" name="HelloWorld">
> <property name="CHECKSTYLE_HOME" value="C:\dev\checkstyle-5.0"/>
> <path id="HelloWorld.classpath">
> <pathelement location="bin"/>
> <pathelement location="lib/commons-lang-2.4.jar"/>
> </path>
> <target name="checkstyle">
> <taskdef name="checkstyle="
> classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
> <classpath>
> <fileset dir="${CHECKSTYLE_HOME}">
> <include name="**/*.jar" />
> </fileset>
> </classpath>
> </taskdef>
>
> <checkstyle config="${CHECKSTYLE_HOME}\sun_checks.xml" >
> <formatter type="xml" toFile="reports/checkstyle/report.xml"/>
> <fileset dir="src">
> <include name="**/*.java"/>
> </fileset>
> </checkstyle>
> </target>
> </project>
>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user