ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
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>
lines):
  <target name="buildJarpath">
    <exec executable="echo" output="jarpath.tmp" dir="${workspace}">
      <arg line="java/lib/*.jar"/>
    </exec>
    <execon executable="sed" output="jarpath.properties"
            dir="${workspace}">
       <arg line="-e 's/^/jar.classpath=/' -e 's/ /:/g'"/>
       <fileset dir="${workspace}">
         <patternset>
           <include name="jarpath.tmp"/>
         </patternset>
       </fileset>
    </execon>
    <delete file="jarpath.tmp"/>
    <property file="jarpath.properties"/>
    <echo message="jar.classpath = ${jar.classpath}"/>
  </target>

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

P.S. All of this assumes latest CVS.

Diane

--- jtnews <jtnews@bellatlantic.net> 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!


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Mime
View raw message