Use <available>
and the "if"/"unless" attributes on <target>

----8<----- (untested) -----8<----

<target name="init"/>
  <available file="c:\xml.jar" property="is.xml.there"/>
</target>

<target name="tasks" depends="init,xml-task,noxml-task"/>

<target name="xml-task" if="is.xml.there">
  <wizz bang="true"/>
</target>

<target name="noxml-task" unless="is.xml.there">
  <wizz bang="false"/>
</target>

----8<----- (untested) -----8<----

(BTW: I think this belongs on ant-user, not ant-dev)

> -----Original Message-----
> From: Gotaparthy, Pradeep [mailto:[EMAIL PROTECTED]
> Sent: Friday, 9 March 2001 8:54 AM
> To: '[EMAIL PROTECTED]'
> Subject: Conditional statements
> 
> 
> How I can test  the existence of object at the build time?
>   Ex: if directory c:\xml.jar is exists
>           then
>             task1
>           else 
>            task2
> 
> 
>                    
>      
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to