Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#554 Problem invoking Checkstyle with Ant

Oliver Burn
ANT Task (45)
Nitin Bhardwaj

Hi Friends,

This is with reference to my previous artifact 2764425 which has been closed, so I was unable to further follow up on that.
The addition that I will like to make in that is:
In the build file that I attached with that artifact(I've attached the same here also) we already have the following entry:

<fileset dir="C:\\nitCheckStyle\\checkstyle-5.0-beta2">
<include name="*.jar"/>

<taskdef resource="" classpathref="checkstyle.classpath"/>

Just a clarification needed on above: Do I need to do anything apart from this also while writing a taskdef for checkstyle?

Thanks & Regards,
Nitin Bhardwaj

Previously posted:
Hi Friends,
The versions used: Ant 1.7.1, Checkstyle 5.0 beta 2, JDK 1.4.
I included checkstyle-5.0-beta2.jar in the classpath.
After this I tried to run the ant for the java files which were contained
in a package. However, it showed me the following error:

C:\nitCheckStyle\StyleTest\CheckstyleBuild>call ant -buildfile buildNew.xml

C:\nitCheckStyle\StyleTest\CheckstyleBuild\buildNew.xml:9: The following
error occurred while executing this line:
C:\nitCheckStyle\StyleTest\CheckstyleBuild\buildNew.xml:21: Problem: 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

Total time: 0 seconds

The build file that I used, has been attached for your ready reference.
Request you to please help me out.

Thanks & Regards,
Nitin Bhardwaj

Comment by oburn: You are not calling <taskdef/> to setup the Checkstyle task. See for correct usage.


  • Nitin Bhardwaj
    Nitin Bhardwaj

    Build file used

  • Nitin Bhardwaj
    Nitin Bhardwaj

    It is a follow-up post on previous post num: 2764425

  • Oliver Burn
    Oliver Burn

    I cannot see how your build script is calling <taskdef/>. I suggest emailing to the Checkstyle User mailing list. This is not a bug.