ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yyy Xxx <gj...@yahoo.com>
Subject AW: Conditionally passing property to <ant>
Date Wed, 30 Apr 2003 11:54:38 GMT
Yes.  I've tried it and it works.  Except that I made a cut-ant-paste
error and put the <condition> within the <ant> instead of at the
sibling level.

The idea is that if "mydir" is not set, you don't want to pass any
property named "mydir" to the nested <ant>.  A garbage value, ${mydir},
still gets passed, but it gets passed with a garbage name.  You still
pass "mydir" (set or not set) but you have control over the name and
so you can either give it a useful name or hide it with some other
name.



> -----Ursprüngliche Nachricht-----
> Von: Jan Matèrne <Jan.Materne@rzf.fin-nrw.de>
> An: Ant Users List
> Betreff: Re: Conditionally passing property to <ant>
>
> Won´t work. Say "mydir" is not set:
> - <isset> evaluate to false
> - propname is not set
> - <ant> got the parameter 'propname' with the String '${mydir}'.
>
> If "mydir" is set it works ...
>
> ... but that does the simple <ant><param/></ant>, too.
>
> (just theory - have you tried?)
>
>
> Jan Matèrne

>> -----Ursprüngliche Nachricht-----
>> Von: Yyy Xxx [mailto:gjfdh@yahoo.com]
>> Gesendet am: Dienstag, 29. April 2003 19:25
>> An: Ant Users List
>> Betreff: Re: Conditionally passing property to <ant>
>> 
>> How about conditionally naming your variable.  Instead of
>> 
>>         <ant ...>
>>             <param name="mydir" value="${mydir}"/>
>>         </ant>
>> 
>> do this:
>> 
>>         <ant ...>
>>             <condition name="propname" value="mydir">
>>                <isset property="mydir"/>
>>             </condition>
>>             <param name="${propname}" value="${mydir}"/>
>>         </ant>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Mime
View raw message