Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: Repeating a task for a list of directories

Peter Reilly

2008-03-06

Replies: Find Java Web Hosting

Author LoginPost Reply
Yes,
normally I keep a lib/ant/-plugin-name-/(jars needed for the plugin)
directory structure and have a ant-contrib.xml importable file to
configure the plugin:

<project name="ant-contrib"
     xmlns:ac="antlib:net.sf.antcontrib">

<typedef uri="antlib:net.sf.antcontrib"
      resource="net/sf/antcontrib/antlib.xml">
  <classpath>
   <fileset dir="lib/ant/ant-contrib" includes="*.jar"/>
  </classpath>
</typedef>

<presetdef name="bash" uri="antlib:net.sf.antcontrib">
  <ac:shellscript shell="bash"/>
</presetdef>


</project>

(note that for ant 1.7.0 you do not need to specify resource when the
uri is an antlib:)

Peter

On Thu, Mar 6, 2008 at 10:47 AM, <Jan.Materne@(protected):
> You should put ant-contrib.jar into your project svn and let the buildfile refer to that (local) location.
>
> PROJECT
>  | build.xml
>  +-- lib/ant
>      +-- ant-contrib.jar
>
>
> build.xml
> ---------
> <project xmlns:ac="antlib:net.sf.antcontrib">
>   <taskdef uri="antlib:net.sf.antcontrib"
>
>         resource="net/sf/antcontrib/antlib.xml"
>         classpath="lib/ant/ant-contrib.jar"/>
>
>   <ac:for param="i" begin="1" end="3">
>      <sequential>
>         <echo>i: ${i}</echo>
>      </sequential>
>   </ac:for>
> </project>
>
>
> Jan
>
> > -----Ursprüngliche Nachricht-----
> > Von: Rob Wilson [mailto:netplay@(protected)]
> > Gesendet: Donnerstag, 6. März 2008 11:34
> > An: Ant Users List
> > Betreff: Re: Repeating a task for a list of directories
>
>
> >
> > Thanks for the information, I believe I need ant-contribs
> > foreach such that
> > I can do some processing for each subdirectory. I've
> > downloaded the jar
> > file and would prefer not to copy it directly into Ant libs
> > folder, such
> > that the next person to do a svn update can run with it
> > without having to
> > think about it.
> >
> > However, the documentation on sourceforge is not explaining
> > how to do this
> > (the homepage version http://ant-contrib.sourceforge.net/
> > contains less
> > information than the other tasks section (
> > http://ant-contrib.sourceforge.net/tasks/index.html).
> >
> > Basically, trying to work out whether I need to reference the .xml or
> > .properties reference, and where it exists - it complains it
> > can't find it,
> > but it's not in the .zip file downloaded... Am I meant to
> > create it? What's
> > in it? Help! ;-)
> >
> > It states....
> >
> > Keep ant-contrib-version.jar in a separate location. You now
> > have to tell
> > Ant explicitly where to find it (say in /usr/share/java/lib):
> >
> > <taskdef *resource="net/sf/antcontrib/antlib.xml*">
> >  <classpath>
> >   <pathelement
> > location="/usr/share/java/lib/ant-contrib-version.jar"/>
> >  </classpath>
> > </taskdef>
> >
> > If you would like to use run with Ant Version 1.5 you must use the the
> > .properties file instead. Keep in mind that some tasks will
> > not be available
> > to you , such as the <for> task:
> >
> > <taskdef resource="net/sf/antcontrib/antcontrib.properties">
> >  <classpath>
> >   <pathelement
> > location="/usr/share/java/lib/ant-contrib-version.jar"/>
> >  </classpath>
> > </taskdef>
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.