You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shailesh Sharma <sh...@yahoo.com> on 2003/10/01 00:03:18 UTC

RE: if/else in ANT ???

correct me if iam wrong......suppose i have some properties like this:
<target name="a">
    <property name="1" value="ONE" />
</target>
<target name="b">    
     <property name="2" value="TWO" />
</target>    
 
 
 
<target name="cc">
--
--
<if>
 <not><equals 1=""/></not>
 <then>
   <env key="APPNAME" value="${1}"/>
 </then>
 <elseif>
  <not><equals 2="" /></not>
  <then>
   <env key="APPNAME" value="${2}"/>
  </then>
 </elseif>
--
--
</target>
 
 
 
now when i run
 
prompt>ant a cc
 
and
 
 
prompt>ant b cc
 
 
 
 
would it work ???????????????
 


Vikas Phonsa <VP...@suz.com> wrote:


This target would execute only if newProp has been set. Using the attribute
"unless" would do the opposite i.e target would execute if the property has
not been set.

Doesn't matter if the property has an empty string or space or whatever.

If you see the ant manual you'll get more details on this and related
topics.




-----Original Message-----
From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com] 
Sent: Tuesday, September 30, 2003 2:41 PM
To: Ant Users List
Subject: RE: if/else in ANT ???


how could i check if the property is been set or not ???



Vikas Phonsa wrote:
I'm not sure what u mean by null. You could use a target with "if" or
"unless" attributes for this to check if a property has been set or not.

If this doesn't work for you then see the tasks in ant-contrib .

vikas


-----Original Message-----
From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com] 
Sent: Tuesday, September 30, 2003 2:15 PM
To: Ant Users List
Subject: if/else in ANT ???


How does this work out in ANT:













if(any of the value is NOT null)

// do something ...

}


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

RE: if/else in ANT ???

Posted by Shailesh Sharma <sh...@yahoo.com>.
 The <exec> task doesn't support the nested "if" element......i need to set some env variables on the basis of some *conditions*
 
how do i do it ????
 
 
 

Shailesh Sharma <sh...@yahoo.com> wrote:
correct me if iam wrong......suppose i have some properties like this:














--
--











--
--




now when i run

prompt>ant a cc

and


prompt>ant b cc




would it work ???????????????



Vikas Phonsa wrote:


This target would execute only if newProp has been set. Using the attribute
"unless" would do the opposite i.e target would execute if the property has
not been set.

Doesn't matter if the property has an empty string or space or whatever.

If you see the ant manual you'll get more details on this and related
topics.




-----Original Message-----
From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com] 
Sent: Tuesday, September 30, 2003 2:41 PM
To: Ant Users List
Subject: RE: if/else in ANT ???


how could i check if the property is been set or not ???



Vikas Phonsa wrote:
I'm not sure what u mean by null. You could use a target with "if" or
"unless" attributes for this to check if a property has been set or not.

If this doesn't work for you then see the tasks in ant-contrib .

vikas


-----Original Message-----
From: Shailesh Sharma [mailto:shailesh_scea@yahoo.com] 
Sent: Tuesday, September 30, 2003 2:15 PM
To: Ant Users List
Subject: if/else in ANT ???


How does this work out in ANT:













if(any of the value is NOT null)

// do something ...

}


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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


---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search