ant-user mailing list archives

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

Hi,

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

by default the antcontrib.properties looks like =

...
# Tasks Requiring Ant 1.6 or higher
#for=net.sf.antcontrib.logic.For
math=net.sf.antcontrib.math.MathTask 

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
ant_extralibs
i have the line set ANT_ARGS=-lib path\to\ant_extralibs in my
ANT_HOME/bin/ant.bat

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
ANT_HOME/lib)
you use =

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


and the <for> task should work.


Regards, Gilbert

 

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

Hi,

I would like to use "for task" from the contrib (currently under
Windows)
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
at:
    http://ant-contrib.sourceforge.net/tasks/tasks/for.html
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?

Thanks,
Fred

Ant File used:

    /<project default="run">/
    /    <property environment="env" />/
    /    <taskdef resource="net/sf/antcontrib/antcontrib.properties">/
    /        <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>/
    /</project>/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message