You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Vineet Chaoji <ch...@roguewave.com> on 2002/07/02 00:50:03 UTC

Conditional processing in Ant

Hi,

I want to set a variable based on some conditions.

<! This is the default -->
<property name="os" value="windows"/>
<condition property="os" value="sun"> <os name="SunOS"/> </condition> 
This does not seem to work. I get the error 
Class org.apache.tools.ant.taskdefs.condition.Os doesn't support the "name"
attribute.
Why should this happen when the Ant manual says that name attribute is
supported?
Is there a workaround?
Thanks,
Vineet



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Conditional processing in Ant

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Are you running Ant 1.5 (of which the docs online are associated with)?

Also, for your default value - set that *after* <condition> otherwise it
will never be set to anything but "windows".  Remember - properties are
immutable!

    Erik

----- Original Message -----
From: "Vineet Chaoji" <ch...@roguewave.com>
To: <an...@jakarta.apache.org>
Sent: Monday, July 01, 2002 6:50 PM
Subject: Conditional processing in Ant


> Hi,
>
> I want to set a variable based on some conditions.
>
> <! This is the default -->
> <property name="os" value="windows"/>
> <condition property="os" value="sun"> <os name="SunOS"/> </condition>
> This does not seem to work. I get the error
> Class org.apache.tools.ant.taskdefs.condition.Os doesn't support the
"name"
> attribute.
> Why should this happen when the Ant manual says that name attribute is
> supported?
> Is there a workaround?
> Thanks,
> Vineet
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Conditional processing in Ant

Posted by Diane Holt <ho...@yahoo.com>.
--- Vineet Chaoji <ch...@roguewave.com> wrote:
> I want to set a variable based on some conditions.
> 
> <! This is the default -->
> <property name="os" value="windows"/>
> <condition property="os" value="sun"> <os name="SunOS"/> </condition> 
> This does not seem to work. I get the error 
> Class org.apache.tools.ant.taskdefs.condition.Os doesn't support the
> "name" attribute.
> Why should this happen when the Ant manual says that name attribute is
> supported?

Because you're not looking at the doc for the same version of Ant you're
running. Your Ant installation comes with a documentation set -- you
should refer to it, rather than the documentation available from Ant's
home page, unless you're running the same version of Ant that the doc from
the web page is for.

> Is there a workaround?

Is upgrading to 1.5 an option? If not, you'll need to check the value of
${os.name} (see "Built-in Properties" in "Using Ant").

Diane

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



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>