ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hewitt <>
Subject RE: criticism: property handling (here: no overwrite)
Date Tue, 10 Jul 2001 13:41:09 GMT
[sorry to be late reading this]

But this solution does not work if (as in my case) ${lib.dir} is
created by another target.

Any suggestions for this case?


-----Original Message-----
From: Stefano Mancarella []
Sent: 13 June 2001 15:06
Subject: Re: criticism: property handling (here: no overwrite)

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