There are two ways of declaring new tasks:
- with properties files
- with antlib.xml files: since Ant 1.6
With Ant 1.6 <macrodef> was introduced with the notion of @{localParameter}.
<ac:for> is the <ac:foreach> equivalent but using the macro way.The difference between <ac:for> and <ac:foreach> is that the latter creates a new project instance for each iteration which requires additional resources. So the prefered way is using <ac:for>. But <ac:foreach> works with Ant before 1.6, so if you have that .... (i recommend updating Ant to 1.8 ;) Jan > -----Ursprüngliche Nachricht----- > Von: David Weintraub [mailto:[email protected]] > Gesendet: Freitag, 16. April 2010 05:32 > An: Ant Users List > Betreff: Re: where to download the latest ant-contrib-1.0b3.jar > > On Thu, Apr 15, 2010 at 7:40 PM, Andy2008 <[email protected]> wrote: > > > > > I did download that zip file and as I mentioned in my post, > the issue is > > there's no for loop in the antcontrib.properties. > > > You're absolutely correct! > > I can't believe it. I never used the "for" task, so never > noticed it before. > There is certainly a class for it > (net.sf.antcontrib.logic.forTask), but > it's not there. > > I did manage to change taskdef to <taskdef > resource="net/sf/antcontrib/antlib.xml"/> and that worked. I > noticed the > antlib.xml file in there, and the "for" task is defined there. > > Here's my build file: > > <taskdef resource="net/sf/antcontrib/antlib.xml"> > <classpath> > <pathelement location="${basedir}/ant-contrib-1.0b3.jar"/> > </classpath> > </taskdef> > <target name="foo"> > <echo message="The first five letters of the alphabet are:"/> > <for list="a,b,c,d,e" param="letter"> > <sequential> > <echo>Letter @{letter}</echo> > </sequential> > </for> > </target> > </project> > > > -- > David Weintraub > [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
