ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Trouble with simple for loops
Date Fri, 06 Feb 2009 14:35:11 GMT
You can use both ...

When using namespaces use autoloading the antlib.
    <ac:for xmlns:ac="antlib:net.sf.antcontrib">

But you can also load the antlib in the old way
    <taskdef resource="net/sf/antcontrib/antlib.xml"/>
    <for>


Jan


>-----Urspr√ľngliche Nachricht-----
>Von: Steve Liu [mailto:stevecliu@gmail.com] 
>Gesendet: Freitag, 6. Februar 2009 14:25
>An: Ant Users List
>Betreff: Re: Trouble with simple for loops
>
>sorry to belabor the point, but I think I'm still not quite getting it:
>>No, thats right.
>>If you want to use <for> you have to have Ant 1.6 or higher (like
>>current 1.7.1).
>><foreach> e.g. works with older Ant versions (like 1.5).
>
>But I can't use <for> but only <ac:for>, right? I understand that the
>difference is just the namespace. But, based on the example 
>given in the doc
>page (basically the thing I had problems with) I didn't need 
>the namespace
>at all. so, how would I get it to work like that (on 1.6 or higher)?
>
>btw, I should have mentioned my ant version: 1.7.1
>
>Thanks,
>Steve
>
>On 2/6/09, Jan.Materne@rzf.fin-nrw.de 
><Jan.Materne@rzf.fin-nrw.de> wrote:
>>
>> >Thanks, that seems to work (missing a </ac:for> tho). I assume
>> >that I would do the same for <foreach>?
>>
>>
>> Yes. AC has a nice pattern:
>> - provide a propertiesfile with tasks for Ant < 1.6
>> - provide a antlib.xml with tasks for Ant >= 1.6, which includes the
>> properties file
>>
>> (If you write your own tasks, you dont need that any more, 
>because 1.6
>> is 'old' ;)
>>
>>
>>
>>
>> >I have a dumb question, according to this page:
>> >http://ant-contrib.sourceforge.net/tasks/tasks/for.html
>> ><for> is valid for ant 1.6 or higher... so the doc is wrong?
>>
>>
>> No, thats right.
>> If you want to use <for> you have to have Ant 1.6 or higher (like
>> current 1.7.1).
>> <foreach> e.g. works with older Ant versions (like 1.5).
>>
>> But there are two differences
>> - how does the task use Ant API --> which version of Ant is required
>> - how is the task declared --> properties/antlib.xml
>>
>>
>> Jan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

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


Mime
View raw message