You can use external tasks in the way of Ant until 1.5 (which is and will supported in the feature too): * place the jar in ${user.home}/.ant/lib, so Ant adds it to its classpath * declare the tasks: - use <taskdef> for the mapping of taskname-classname + for each task + for a bundle of tasks using properties-file
Since Ant 1.6 we have "Antlibs". Same here: * place the jar in ${user.home}/.ant/lib, so Ant adds it to its classpath * declare the tasks - use <taskdef> for the mapping of taskname-classname + for each task <taskdef name="for" classname="net.sf.antcontrib.For"/> + for a bundle of tasks using properties-file <taskdef file="net/sf/antcontrib/default.properties"/> + NEW: for a bundle of tasks using xml-file <taskdef file="net/sf/antcontrib/antlib.xml"/> - NEW: use of xml namespaces and "antlib:" protocol for a bundle of tasks using the xml file (antlib.xml) <project .... xmlns:ac="antlib:net.sf.antcontrib"> <ac:for> I'll put a note into the manual at "Using Ant :: (NEW) Use of external tasks" Jan >-----Ursprüngliche Nachricht----- >Von: Rebhan, Gilbert [mailto:[EMAIL PROTECTED] >Gesendet: Donnerstag, 19. Oktober 2006 08:56 >An: Ant Users List >Betreff: RE: Task help > > >sorry, it's enough to reference the namespace if >antcontrib.jar is in ANT_HOME/lib directory > >so you could either put antcontrib in its own namespace = > ><project name="bla" default="vss" xmlns:ac="antlib:net.sf.antcontrib"> > >and ><ac:for ...> >... ></ac:for> > >or without ancontrib in own namepsace = > ><project name="bla" default="vss"> > ><taskdef resource="net/sf/antcontrib/antlib.xml"/> > >and > ><for ...> >... ><:for> > > >Regards, Gilbert > > >-----Original Message----- >From: Rebhan, Gilbert [mailto:[EMAIL PROTECTED] >Sent: Thursday, October 19, 2006 8:51 AM >To: Ant Users List >Subject: RE: Task help > > >Hi, > >you forgot to reference the namespace = > ><project name="bla" default="vss" xmlns:ac="antlib:net.sf.antcontrib"> > >beside = ><taskdef resource="net/sf/antcontrib/antlib.xml"/> > >to make = > ><ac:for ...> >... ></ac:for> > >work. > >also i would use antcontrib 1.0b2 instead of the old 0.6 > > >Regards, Gilbert > > > >-----Original Message----- >From: bill/wilandra [mailto:[EMAIL PROTECTED] >Sent: Wednesday, October 18, 2006 10:49 PM >To: 'Ant Users List' >Subject: RE: Task help > >Try this taskdef instead and see if it helps: ><taskdef resource="net/sf/antcontrib/antlib.xml"/> > >HTH Bill > >-----Original Message----- >From: Muthyala, Sunil [mailto:[EMAIL PROTECTED] >Sent: Wednesday, October 18, 2006 11:23 AM >To: 'Ant Users List' >Subject: RE: Task help > >Thanks to Jan and Steve Loughran. > >I tried Jan's suggestion, I get an error > >I downloaded the Ant-contrib-0.6.jar and dropped it in ant/lib >directory and included the <taskdef> in build.xml. > >Here is the build.xml > >---- ><project name="CF" default="vss"> ><taskdef resource="net/sf/antcontrib/antcontrib.properties"/> > ><target name="cf"> ><loadfile property="list" file="C:\vss_home\cffiles.txt"/> > <ac:for param="file" list="list" delimiter=";"> > <sequential> > <echo> @{file} </echo> > </sequential> > </ac:for> > </target> > ><target name="vss" depends="cf"> ><vssget localPath="C:\vss_home" > ssdir="V:\Job_Tracking\ANT" > serverPath="V:\Job_Tracking" > login="***,***" > vsspath="${list}"/> ><echo message="VSS-GET successful"/> > </target> ></project> >------ >This is the error I get > >C:\apache-ant-1.6.5\bin>ant -f C:\apache-ant-1.6.5\build_AC.xml >Buildfile: C:\apache-ant-1.6.5\build_AC.xml > >BUILD FAILED >C:\apache-ant-1.6.5\build_AC.xml:6: The prefix "ac" for >element "ac:for" >is >not bound. > >Total time: 0 seconds > > >What mistake I am doing? > >-thanks >Sunil > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Sent: Tuesday, October 17, 2006 10:19 AM >To: user@ant.apache.org >Subject: AW: Task help > >>1. How to unzip a folder on a remote server (Windows NT), >>I am unable >>to nest it inside of FTP. >> >>I am zipping a folder on local machine and FTP'ing it to the server, >>but I need to unzip it in tmp folder and move the unzipped folder to >>the right path on the server. Does REXEC work for windows box? > >Try <sshexec> - its more secure ... > > > >>2. I want to read the txt or doc which has full path and >>file names of >>files to be pulled from VSS. >> >>I need to feed the contents of this txt file as input to the >vsspath, I > >>tried using LOADFILE and saving it as property, but it reads >only first > >>line and not the subsequent. Does ANT have a for loop kind of command >>or any other to this kind of job. > > ><loadfile> should load the whole file into a property. >Ant-Contrib has a <for> which you can feed with that value. > > <loadfile property="list" file="..."/> > <ac:for param="file" list="list" delimiter=";"> > <sequential> > <echo> @{file} </echo> > </sequential> > </ac:for> > > > >Jan > >--------------------------------------------------------------------- >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] > > > > > >--------------------------------------------------------------------- >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] > > >--------------------------------------------------------------------- >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]