#17 ant-contrib test build fails


This task seems to assume quite a bit about the surrounding
environment. I made a directory in /usr/local/ and
grabbed a copy from CVS as per instructions

$ ant test
Buildfile: build.xml



[javac] Compiling 4 source files to
cannot resolve symbol
[javac] symbol : class BuildFileTest
[javac] location: package ant
[javac] import org.apache.tools.ant.BuildFileTest;
[javac] ^


[javac] 65 errors

file:/usr/local/ant-contrib/build.xml:298: Compile
failed; see the compiler error output for details.


From 'build.xml', I noticed these definitions:

<property name="ant.testutil"

<property name="junit.jar"

Perhaps some additional dependencies like these below
might be more helpful to non-project developers:

<target name="ant.testutil-avail">
<available file="${ant.testutil}"
<fail unless="ant.testutil.available"
message="ANT testutil from src distribution
not found"/>

<target name="junit-avail">
<available file="${junit.jar}"
<fail unless="junit.available"
message="JUnit not found"/>

Just a thought...


  • peter reilly

    peter reilly - 2003-04-20

    Logged In: YES

    There is now a HOW-TO-RUN-THE-TESTS file
    which should address this bug report

  • Paul Roebuck

    Paul Roebuck - 2003-04-21

    Logged In: YES

    The document explains the test requirements. It meant to
    imply that
    the choice must be made for each JAR file and associated
    The wording concerning the choices is imprecise due to the
    lack of distinction between files and properties. Perhaps
    the following:

    You can also combine the two methods. For example, the files
    junit.jar and optional.jar may both be placed on the
    CLASSPATH and the property for ant.testutil be overridden.

    'be in the claspath as well, then.' has classpath misspelled.

    I still think the changes should be added to 'build.xml' as
    a solution closer to the source of the problem. Better to
    fail the build with an explicit error noting a configuration
    problem than to have the build fail during compilation and
    have configuration documentation elsewhere.

    Maybe modifying the original suggestion to be conditional on
    being found on the classpath as such:

    <target name="junit-avail">
    <available classname="junit.framework.Test"
    <fail unless="junit.available"
    message="JUnit not found on classpath"/>

    <target name="compile-tests" depends="junit-avail,

  • Matt Inger

    Matt Inger - 2003-11-12

    Logged In: YES

    You must have the ant source code available as they do not
    include the BuildFileTest class in their distribution. :( This is
    not something we can avoid right now. The workaround is to
    get the ant source, compile that file, and add it to your

  • Paul Roebuck

    Paul Roebuck - 2003-11-12

    Modified build script that checks for prereqs

  • Paul Roebuck

    Paul Roebuck - 2003-11-12

    Logged In: YES

    Almost a year later and still no change whatsoever to
    I doubt it still works for the jar files as defined anyway
    since Ant is no longer a jakarta subproject.

    Rather than making the minor modification that was supplied long
    ago (which would have closed the bug as far as I'm
    concerned), it continues to be discussed as only a process
    problem. This has not been a complete loss since the bug did
    cause some documentation to get written.

    I know the process and the requirements for ant-contrib. My
    point is that the build script does not and it can be easily
    fixed to eliminate the problem. Please see attached build
    script modifications. If acceptable, checkin to CVS and
    close this bug.

  • Matt Inger

    Matt Inger - 2003-11-25

    Logged In: YES

    I have modified the buildfile so that it will do the following
    when building and/or running the tests:

    1. Download "junit.jar" from ibiblio.org
    2. Download the ant 1.5.4 source distribution from
    ant.apache.org, and build the "ant-testutil.jar" file from that

    We then include the downloaded junit.jar and ant-testutil.jar
    in the compile and run classpaths for the tests. We can take
    a similar strategy in the future if we add jars that are needed
    for compile and runtime of the actual tasks (though we have
    to account for the license file in those cases as well).

  • Matt Inger

    Matt Inger - 2003-11-25
    • status: open --> closed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks