Using CactusTask in Ant1.6

Posted on 2004-10-21
Last Modified: 2012-08-14
Hi, Im having real trouble using the CactusTask in Ant1.6, as a minimal test, I have the following ant script;

<project name="Cactus Test" default="init" basedir=".">
      <taskdef name="cactus" classname="org.apache.cactus.integration.ant.CactusTask">
                        <pathelement location="cactus-ant-1.6.1.jar"/>

now I have put cactus-ant-1.6.1.jar in the working dir and verified that org.apache.cactus.integration.ant.CactusTask is in it.
But when i run it i still get the following:

file:C:/projects/Enterprise/CactusTests/build.xml:3: taskdef class org.apache.cactus.integration.ant.CactusTask cannot be found

Does anyone have any idea why this doesnt work?
Question by:blackfrancis75
    LVL 92

    Accepted Solution

    try putting them in the lib directory of ant.
    LVL 5

    Author Comment

    I tried that and it doesnt help...
    LVL 5

    Author Comment

    further to this problem, i just ran it with ant - verbose on and I got this:

    --- Nested Exception ---
    java.lang.NoClassDefFoundError: junit/framework/TestListener
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(
            at java.lang.Class.getDeclaredConstructors(

    I tries putting the junit jar in the ANT lib directory but this didnt help...
    LVL 5

    Author Comment

    I found this in the JUnit doco:

    Note: You must have junit.jar and the class files for the <junit> task in the same classpath. You can do one of:

    1.Put both junit.jar and the optional tasks jar file in ANT_HOME/lib.
    2.Do not put either in ANT_HOME/lib, and instead include their locations in your CLASSPATH environment variable.
    3.Do neither of the above, and instead, specify their locations using a <classpath> element in the build file. See the FAQ for details.

    I tried all three of these to no avail...
    LVL 5

    Author Comment

    OK well i have resolved this - Im not sure what was wrong but I installed a completely new version of ANT and moved the JUnit jar file into ANT\lib and it seems to work ok now.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now