ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joey Gibson <j...@joeygibson.com>
Subject Re: Filesets for echo and available?
Date Wed, 18 Dec 2002 14:06:47 GMT
On Tue, 17 Dec 2002 23:05:21 -0500, "Guy Rouillier"
<guy-rouillier@speakeasy.net> wrote:

||| The issue I have is that in order
||| to do this, I've had to list my jar files 3 different times: for the echo,
||| for the condition, and finally for the classpath.  

Instead of doing available on the individual jars, why not create your
classpath and then check if a specific class that would be in each jar is
available. For example

<project name="av" basedir="." default="test">
 <target name="init">
  <path id="clp">
   <pathelement location="c:\OpenSource\jdom\jdom\build\jdom.jar"/>
   <pathelement location="c:\tmp\foo.jar"/>
  </path>
 </target>

 <target name="test" depends="init">
  <condition property="avail">
   <and>
	<available classname="org.jdom.Element" classpathref="clp"/>
	<available classname="org.jdom.Attribute" classpathref="clp"/>
   </and>
  </condition>
  <echo message="Av = ${avail}"/>
 </target>
</project>

Then you would only have the jars listed in one place, the classpath. Your
echos could be take care of in two statements. Put this

<propery name="clps" refid="clp"/> 

in your init. It just creates a property "alias" for the classpath you just
created and then put this

<echo message="CLPS = ${clps}"/>

wherever you want to echo the value. It will print out the classpath, which
is essentially what your echos were doing anyway.

Does that help?



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message