[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?

#!/mjh

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


From: "Christopher Berry" <[EMAIL PROTECTED]>
> 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
exist
> 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" />
 </path>

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

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

Reply via email to