Solved

Using CactusTask in Ant1.6

Posted on 2004-10-21
310 Views
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">
            <classpath>
                        <pathelement location="cactus-ant-1.6.1.jar"/>
            </classpath>
      </taskdef>
</project>


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:

BUILD FAILED
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?
Regards,
0
Question by:blackfrancis75
    5 Comments
     
    LVL 92

    Accepted Solution

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

    Author Comment

    by:blackfrancis75
    I tried that and it doesnt help...
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    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(Class.java:1610)
            at java.lang.Class.getDeclaredConstructors(Class.java:1169)


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

    Author Comment

    by:blackfrancis75
    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...
    0
     
    LVL 5

    Author Comment

    by:blackfrancis75
    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.
    0

    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