#17 ant-contrib test build fails

closed
nobody
None
5
2003-11-25
2002-12-02
No

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
(module=ant-contrib):
<http://sourceforge.net/cvs/?group_id=36177>.

-------------------------------------------------------------------------------------
$ ant test
Buildfile: build.xml

build_dirs:

build_contrib_jar:

compile-tests:
[javac] Compiling 4 source files to
/usr/local/ant-contrib/test/classes
[javac]
/usr/local/ant-contrib/test/src/net/sf/antcontrib/logic/IfTaskTest.java:51:
cannot resolve symbol
[javac] symbol : class BuildFileTest
[javac] location: package ant
[javac] import org.apache.tools.ant.BuildFileTest;
[javac] ^

[***SNIP***]

[javac] 65 errors

BUILD FAILED
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"

location="../jakarta-ant/build/lib/ant-testutil.jar"/>
<property name="junit.jar"
location="../junit3.8.1/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}"
property="ant.testutil.available"/>
<fail unless="ant.testutil.available"
message="ANT testutil from src distribution
not found"/>
</target>

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

Just a thought...

Discussion

  • peter reilly

    peter reilly - 2003-04-20

    Logged In: YES
    user_id=690869

    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
    user_id=660819

    The document explains the test requirements. It meant to
    imply that
    the choice must be made for each JAR file and associated
    property.
    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"
    classpath="${junit.jar}"
    property="junit.available"/>
    <fail unless="junit.available"
    message="JUnit not found on classpath"/>
    </target>

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

     
  • Matt Inger

    Matt Inger - 2003-11-12

    Logged In: YES
    user_id=83032

    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
    classpath.

     
  • Paul Roebuck

    Paul Roebuck - 2003-11-12

    Modified build script that checks for prereqs

     
    Attachments
  • Paul Roebuck

    Paul Roebuck - 2003-11-12

    Logged In: YES
    user_id=660819

    Almost a year later and still no change whatsoever to
    'build.xml'.
    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
    user_id=83032

    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