Don't use verbose mode.  When you do, it turns on verbosity
for ANTCALL, which is used internally within the foreach task.
AntCall has alot of verbose output, as you can see.  There is nothing
that the ForEach task can do to avoid this.


<?xml version="1.0" ?>
<project basedir="." name="test" default="test">
    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>


    <target name="do.echo">
        <echo message="${param}" />
    </target>
    <target name="test">

        <foreach list="1,2,3,4,5,6"
                 target="do.echo"
                 param="param" >
        </foreach>
    </target>

</project>



Without verbose mode:
-----------------------
E:\home\inger\ant-contrib>ant -f test.xml
Buildfile: test.xml

test:

do.echo:
     [echo] 1

do.echo:
     [echo] 2

do.echo:
     [echo] 3

do.echo:
     [echo] 4

do.echo:
     [echo] 5

do.echo:
     [echo] 6

BUILD SUCCESSFUL



with verbose mode:
-------------------------
E:\home\inger\ant-contrib>ant -verbose -f test.xml
Apache Ant version 1.5.3 compiled on April 16 2003
Buildfile: test.xml
Detected Java version: 1.3 in: E:\SynDev\jdk1.3.1\jre
Detected OS: Windows 2000
parsing buildfile test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Build sequence for target `test' is [test]
Complete build sequence is [test, do.echo]

test:
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 1
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 2
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 3
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 4
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 5
  [antcall] calling target do.echo in build file E:\home\inger\ant-contrib\test.xml
parsing buildfile E:\home\inger\ant-contrib\test.xml with URI = file:E:/home/inger/ant-contrib/test.xml
Project base dir set to: E:\home\inger\ant-contrib
  [taskdef] Loading definitions from resource net/sf/antcontrib/antcontrib.properties
Ignoring override for task if, it is already defined by the same class.
Ignoring override for task propertycopy, it is already defined by the same class.
Ignoring override for task foreach, it is already defined by the same class.
Ignoring override for task outofdate, it is already defined by the same class.
Ignoring override for task urlencode, it is already defined by the same class.
Ignoring override for task shellscript, it is already defined by the same class.
Ignoring override for task trycatch, it is already defined by the same class.
Ignoring override for task compilewithwalls, it is already defined by the same class.
Ignoring override for task propertyregex, it is already defined by the same class.
Ignoring override for task pathtofileset, it is already defined by the same class.
Ignoring override for task runtarget, it is already defined by the same class.
Ignoring override for task timestampselector, it is already defined by the same class.
Ignoring override for task throw, it is already defined by the same class.
Ignoring override for task switch, it is already defined by the same class.
Ignoring override for task propertyselector, it is already defined by the same class.
Ignoring override for task sortlist, it is already defined by the same class.
Ignoring override for task osfamily, it is already defined by the same class.
Build sequence for target `do.echo' is [do.echo]
Complete build sequence is [do.echo, test]

do.echo:
     [echo] 6

BUILD SUCCESSFUL

----------------
Matthew Inger [inger@synygy.com]
Software Developer
Synygy, Inc
610-664-7433 x 7770
"Man who jump off cliff, leap to conclusions." - Confucious


-----Original Message-----
From: Adam Hardy [mailto:adam.ant@cyberspaceroad.com]
Sent: Monday, October 06, 2003 1:16 PM
To: ant-contrib-developers@lists.sourceforge.net
Subject: [Ant-contrib-developers] foreach


I hope you developers won't kill me if I post a question here about the
ant-contrib foreach task :) but I have googled, ant-usered and generally
not got very far with this issue.  The project forum on sourceforge
looked pretty dead too, so here I am.

I posted originally on the ant-users list and had no replies, which is
often a bad sign that what I want to do is impossible, but I thought I
would try to get a reply from the original authors before giving up.

I am using foreach to copy some jars from a list during my deploy task
as follows:

<target name="deploy" depends="compile">
   <mkdir  dir="${deploy.home}/${app.name}/WEB-INF/lib"/>
   <foreach list="${external.jars}"
       delimiter=":"
          target="jarcopy"
           param="jarfile">
      <param name="jartodir"
value="${deploy.home}/${app.name}/WEB-INF/lib"/>
   </foreach>
</target>

<target name="jarcopy" depends="">
   <copy todir="${jartodir}" file="${jarfile}" />
</target>

This works fine but there is alot of output since I have about 30 jars
in the list. This scrolls the output of the previous tasks, e.g.
compile, up off the screen. Even when it doesn't copy a file I get 3
lines of output like this:

"buildFile==/home/adam/src/projects/blacksailbase/build.xml

jarcopy:"

Is there a way to suppress the output? Even just the buildFile statement?

Or could I rewrite the task somehow to reduce output?

In an ideal world I would like to have just one line of output how many
files it copied - or perhaps just one line for each file copied.

Thanks in advance for any help,

Adam
--
ant 1.6alpha + java 1.4.2 on Linux 2.4.20 RH9



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Ant-contrib-developers mailing list
Ant-contrib-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ant-contrib-developers