ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: how to make a classpath like "/java/lib/*.jar"?
Date Tue, 26 Sep 2000 20:24:36 GMT
You can do it using <exec> and <execon> (I'm pretty sure you need the
<execon> stuff, since I don't seem to be able to include pipes in <arg>
  <target name="buildJarpath">
    <exec executable="echo" output="jarpath.tmp" dir="${workspace}">
      <arg line="java/lib/*.jar"/>
    <execon executable="sed" output=""
       <arg line="-e 's/^/jar.classpath=/' -e 's/ /:/g'"/>
       <fileset dir="${workspace}">
           <include name="jarpath.tmp"/>
    <delete file="jarpath.tmp"/>
    <property file=""/>
    <echo message="jar.classpath = ${jar.classpath}"/>

(Just be sure everything in java/lib is really what you want :)

P.S. All of this assumes latest CVS.


--- jtnews <> wrote:
> 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!


Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.

View raw message