ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Mancarella" <>
Subject Re: criticism: property handling (here: no overwrite)
Date Wed, 13 Jun 2001 14:06:03 GMT
From: "Christopher Berry" <>
> Conor hit the nail on the head. There are times when the path needs to
> contain items which do not yet exist. In my case, this is actually
> dependent on a Task firing -- I unpack different "distributions" which
> initially as TAR.GZ files.
> Ideally I want a single <path> defined (my Classpath) -- at the top of the
> file -- which is used by reference in several Tasks. (The ol' Don't Repeat
> Yourself rule again ;-). But that isn't possible right now because the
> <path> element is evaluated up-front (and croaks). A lazy evaluation would
> fix my situation.

I had exactly the same problem.
I've solved it using a nested <fileset> in my path definition which includes
all jars in a directory. It works perfectly: my classpath contains also jars
added to that directory after the path definition.
Here's an example:

 <path id="cpath">
  <fileset dir="${lib.dir}" includes="*.jar" />

 <target name="init">
  <copy file="${some.dir}/library1.jar" todir="${lib.dir}" />
  <get src="" dest="${lib.dir}/library2.jar"

 <target name="build" depends="init">
  <javac classpathref="cpath" srcdir="${src.dir}" destdir="${build.dir}" />

View raw message