ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: Can't use FOR Task from contrib while FOREACH works fine !?
Date Mon, 02 Jan 2006 16:47:29 GMT


i believe it's cause you're using the, which was the old way for
mapping the taskdefs to the corresponding classes.

by default the looks like =

# Tasks Requiring Ant 1.6 or higher

which means the mapping for= ...
is switched off by the leading #

so the for task can't be created.

When using antcontrib with ant 1.6.x you should use antlib.xml.

my settings here = 
i have all extra tasks including antcontrib.jar in a directory
i have the line set ANT_ARGS=-lib path\to\ant_extralibs in my

so i can use

<!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" />

in my antscript.If you don't bother about keeping the ant/lib dir clean,

you may also put the antcontrib.jar into ANT_HOME/lib

alternative (no editing of ANT_HOME/bin/ant.bat, no antcontrib in
you use =

!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
            <pathelement location="path/to/antcontrib.jar"/>

and the <for> task should work.

Regards, Gilbert


-----Original Message-----
From: Frederic Chalons [] 
Sent: Monday, January 02, 2006 4:05 PM
To: Ant Users List
Subject: Can't use FOR Task from contrib while FOREACH works fine !?


I would like to use "for task" from the contrib (currently under
I quite confused since I am able to invoked the foreach task (target 
"run-each") with no problem.
However the target "run" fails and is a copy/paste of the first exampe
I get the following reply:
/    could not create task of type of type: for/

Do I need to perform any further configuration beside setting the PATH 
and defining the resource task?


Ant File used:

    /<project default="run">/
    /    <property environment="env" />/
    /    <taskdef resource="net/sf/antcontrib/">/
    /        <classpath>/
    /            <pathelement
    location="${env.ANTCONTRIB_HOME}/lib/ant-contrib.jar" />/
    /        </classpath>/
    /    </taskdef>/
    /    /
    /    <target name="run">/
    /        <for list="a,b,c,d,e" param="letter">/
    /            <sequential>/
    /                <echo>Letter @{letter}</echo>/
    /            </sequential>/
    /        </for>/
    /    </target>/
    /    /
    /    <target name="run-each">/
    /        <foreach list="a,b,c,d,e" param="letter" target="print"/>/
    /        </target>/
    /    <target name="print">/
    /        <echo>${letter}</echo>/
    /    </target>/

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message