ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: Simple if/else Condition
Date Fri, 27 Jul 2007 13:35:31 GMT
Of course, you could also just use Ant-contrib's<if> task...  It 
supports if-then-else functionality.

Michael Giroux wrote:
> Hi Evan,
>
> On 7/17/07, Evan J <maps.this.address@gmail.com> wrote:
>
>   
>> if (condition)
>>  perform some task, i.e. echo message="condition met"
>> else
>>  perform another task
>>
>> Is there such task available in Ant 1.7?
>>     
>
> This can be accomplished by wrapping the tasks in individual targets
> then defining a target that drives the others via depends:
> <condition property="condition.is.set">
>   <!-- your test hee -->
> </condition>
> <target name="t1" if="condition.is.set">
>   <echo>condition was true</echo>
> </target>
> <target name="t2" unless="condition.is.set">
>   <echo>condition was false</echo>
> </target>
>
> <target name="driver" depends="t1,t2">
>   <!-- if condition.is.set then t1 is executed else t2 is executed -->
> </target>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message