Joey, thanks for the idea.  I could use a fileset to initially define my
list of files, then define the classpath from that.  Using your idea below,
I could define a property for that classpath and echo that property.  I
think this will produce a typical classpath, i.e., with all files run
together, separated by a colon - not as easy to read, but containing the
same information.  But it looks like available will still require me to
specify another whole set.  Your idea below of checking for a class in the
classpath doesn't appear to save any work.  If I had 20 jars I wanted to
check for, I'd need 20 available statements, either one per jar or one per
class.  Plus I'd now have to identify a distinct class per jar.

I think I'll submit a suggestion to enhance available to check for filesets
as well as individual files.

----- Original Message -----
From: "Joey Gibson" <[EMAIL PROTECTED]>
To: "Ant Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 9:06 AM
Subject: Re: Filesets for echo and available?


> On Tue, 17 Dec 2002 23:05:21 -0500, "Guy Rouillier"
> <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to