ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Ferdig <pfer...@comergent.com>
Subject RE: criticism: property handling (here: no overwrite)
Date Mon, 16 Jul 2001 11:08:17 GMT
has there been any progress on this issue?  I've just run into it, and am
trying to resolve it.

the problem is that I have a directory specified in my global classpath that
doesn't always exist.  in fact, I can't even run the task that creates the
directory because I can't get past the initial parsing of the build.xml
file.

short term solution: I'm looking into appending the specific directory to
the classpath in the targets that utilize it and removing it from the global
classpath, but that's a bit contrary to using a global path in the first
place.

Cheers,

Pat

-----Original Message-----
From: Mark Hewitt
To: 'ant-user@jakarta.apache.org'
Sent: 7/10/2001 6:41 AM
Subject: RE: criticism: property handling (here: no overwrite)

[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:mancarella@opoipi.bancaintesa.it]
Sent: 13 June 2001 15:06
To: ant-user@jakarta.apache.org
Subject: Re: criticism: property handling (here: no overwrite)


From: "Christopher Berry" <christopher.berry@etrade.com>
> 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>

Mime
View raw message