Apache Ant - classpath



Hello,

Apache Ant version 1.6.2

I have a problem with my Ant script. I create a classpath reference at
the start of the script, like this:

<path id="classpath">
<pathelement location="/myjar.jar"/>
<pathelement location="/myotherjar.jar"/>
<pathelement location="/my3rdjar.jar"/>
</path>

.... but when I reference this from one of the targets in the build
script (a JUnit test), it doesn't seem to be picking up the elements
in the reference.

I define the classpath in the target as below. I need to add
additional jars into the classpath at this point, so I use
<pathelement location=""/> to do this.

<target name="test">
<junit printsummary="no">
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="/myadditionaljar.jar"/>
</classpath>
.... etc...

When I try and run the target from the script, I get lots of
java.lang.NoClassDefFoundError exceptions - the classes which should
be included in the <classpath> reference.

I'm guessing that the line in error is <pathelement
path="${classpath}"/>, but I can't work out why. The online manual
offers no obvious solution.

If I replace the <pathelement path="${classpath}"/> line with a repeat
of the <pathelement location=""/> lines for the jars I defined at the
top of my script, it works without a problem.

Thanks for any assistance,

Oaf
.



Relevant Pages

  • Re: Apache Ant - classpath
    ... > Apache Ant version 1.6.2 ... > I have a problem with my Ant script. ... I create a classpath reference at ... > I define the classpath in the target as below. ...
    (comp.lang.java.softwaretools)
  • Re: window object
    ... Within a script, every reference to an object amounts to two ... calls from the scripting engine to the DHTML Object Model. ... var sText = document.all.div1.innerText; ...
    (comp.lang.javascript)
  • Re: IsValid(Object)
    ... > I have a complex problem involving a linked list, a scripted for-loop, a ... > reference to an object instance, ... > script commands that can arbitrarily modify the database. ...
    (borland.public.delphi.language.objectpascal)
  • Re: How to catch error message instead of printing to stderr for rmtree
    ... script and CPAN's documentation. ... it still print the error message to stderr. ... to hold a reference to a variable, which will be used to store the ...
    (perl.beginners)
  • Re: What does this script means?
    ... write it in the global part of the script, ... it is perfectly valid to use a function reference as the operand ... Array in the original code). ...
    (comp.lang.javascript)