"for" task with "list" parameter in ant-contrib does not work

14,290

Cannot reproduce your issue. What version of ANT are you using?

Example

$ ant -version
Apache Ant(TM) version 1.9.0 compiled on March 5 2013

$ ant
Buildfile: /home/mark/build.xml

run:
     [echo] param: one
     [echo] param: two
     [echo] param: three
     [echo] param: four

BUILD SUCCESSFUL
Total time: 0 seconds

build.xml

<project name="ant-contrib-tasks" default="run">

    <taskdef resource="net/sf/antcontrib/antlib.xml"/>

    <target name="bootstrap">
        <mkdir dir="${user.home}/.ant/lib"/>
        <get dest="${user.home}/.ant/lib/ant-contrib.jar" src="http://search.maven.org/remotecontent?filepath=ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar"/>
    </target>

    <target name="run">
        <for param="theparam" list="one,two,three,four">
            <sequential>
                <echo message="param: @{theparam}"/>
            </sequential>
        </for>
    </target>

</project>

Notes:

  • Special "bootstrap" target installs the ant-contrib dependency.
Share:
14,290
rabejens
Author by

rabejens

Updated on June 04, 2022

Comments

  • rabejens
    rabejens almost 2 years

    I have a construct like this in my build script:

    <for list="item1,item2,item3,item4" param="theparam">
        <!-- some stuff to do -->
    </for>
    

    When executing the script, I get:

    Invalid type class net.sf.antcontrib.logic.ForTask used in For task, it does not have a public iterator method

    I am using ant-contrib 1.0b3. What am I missing here?