ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Problem with classpath
Date Thu, 09 Nov 2000 16:52:39 GMT
--- Stefan Schmitt <> wrote:
> I need it for the whole Ant process! So it is impossible.


Don't be discouraged -- nothing is impossible. :)

I think there could be some confusion about what it is you're actually
needing to do. Do you know ahead of time what the jar-files are that will
be getting put into place by your MyClass utility? If you do, then you can
put that list of jars into a properties file, then read that file in from
your build.xml file using the <property file="">. If you
want to point to them in ${Src.dir}, just be sure the Src.dir property is
set in your build.xml file before you read in the file.

So, for, you'd have something like:

Then, in your build.xml file, outside of any target, do:
  <property name="Src.dir" value="drive:/some/path/here"/>
  <property file=""/>

If you want Src.dir to not be hard-coded, you can pass a value for it on
the 'ant' command-line (probably automatically figured out in your .bat
file), and not do the first <property> setting above.

Then, in any task that needs these jars included in their classpath,
including any in sub-projects, just reference the property. For example:
  <javac ...(attributes)... >
      <pathelement path="${}"/>

If you don't actually know ahead of time what the jar-files are, you could
still do something to get the file generated (probably
need some script that's called after the <java classname="MyClass"...>
task), then use the <property file=""/> once the file's
been generated. As long as you set that path as a property value, it won't
matter if you do the <property file=""/> inside a target
-- once a property's been set, it's available throughout the build (both
for targets in the local file, and for sub-project files as well).

I hope this helps,


Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one Place.

View raw message