Java Mailing List Archive

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

Home » Ant Users List »

AW: Repeating a task for a list of directories

Jan Materne

2008-03-06

Replies:

Author LoginPost Reply
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)

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