ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KC Baltz <>
Subject RE: how to make a classpath like "/java/lib/*.jar"?
Date Tue, 26 Sep 2000 20:15:27 GMT
I have a task that does this.  It can either write to or append to a
property.  It works with Ant 1.1, but I suspect 1.2 will/should break it
because of the changes to the <property> architecture.  I'm attaching the
source with no promises/guarantees of its suitability.  

Here's the taskdef (No I didn't make it part of the standard Ant tree, I'm
<taskdef name="getjars" classname="GetJars"/>

Here are some example usage lines

<getjars target_property="jarClassPath"
basedir="${srcdir}\com\responsenetworks\lib" append="false" />
<getjars target_property="jarClassPath"
basedir="${srcdir}\com\responsenetworks\install" append="true" />

These two lines place the names of all .jar and .zip files found in the lib
and install directories into a property called jarClassPath.  Then, when I
declare my classpath, I just insert a reference to this property.

K.C. Baltz

> -----Original Message-----
> From: jtnews []
> Sent: Tuesday, September 26, 2000 2:57 PM
> To:
> Subject: how to make a classpath like "/java/lib/*.jar"?
> is there anything in ant that allows you to expand
> all the jar files in a directory into a classpath?
> For example,
> if I have a.jar, b.jar, c.jar in /java/lib,
> how can I make a classpath like 
> /java/lib/a.jar:/java/lib/b.jar:/java/lib/c.jar 
> without having to specify each jar file manually?
> Something equivalent to the Bourne shell
> CLASSPATH=`echo /java/lib/*.jar | tr ' ' ':'`
> would be really nice!

View raw message