ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dick, Brian E." <>
Subject RE: if then
Date Mon, 26 Sep 2005 12:49:42 GMT
Since ant properties are immutable, all you have to do is set BAR the
value of FOO.

<property name="BAR" value="${FOO}/>

If BAR has been previously set, then this statement will have no effect.

-----Original Message-----
From: Kai Hendry [] 
Sent: Monday, September 26, 2005 12:32 AM
To: Ant Users List
Subject: if then

I want to do something quite simple, but with Ant it seems really

I want to check a property BAR exists. If it is not set, then set it to 
another property called FOO.

In shell:
if [ ! $BAR ]; then BAR=$FOO ; fi
echo $BAR $FOO

Right now I think I have to setup a separate target. Which is insane. 
Because I would need to call it somehow if the condition isn't met.

I got this far:

<target name="init">

        <condition property="isBARset">
            <isset property="BAR" />
<!-- how do I tastefully call THEN  ?? -->


<target name="THEN" if="isBARset">
 <property name="BAR"  value="${FOO}" />

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message