Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
For loop &引用;至于;带“的任务”;列表“;ant contrib中的参数不起作用_For Loop_Ant_Ant Contrib - Fatal编程技术网

For loop &引用;至于;带“的任务”;列表“;ant contrib中的参数不起作用

For loop &引用;至于;带“的任务”;列表“;ant contrib中的参数不起作用,for-loop,ant,ant-contrib,For Loop,Ant,Ant Contrib,我的构建脚本中有这样一个构造: <for list="item1,item2,item3,item4" param="theparam"> <!-- some stuff to do --> </for> 执行脚本时,我得到: 任务中使用的类型类net.sf.antcontrib.logic.ForTask无效,它没有公共迭代器方法 我正在使用ant contrib 1.0b3。我在这里遗漏了什么?无法重现您的问题。你使用的是什么版本的ANT 例

我的构建脚本中有这样一个构造:

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

执行脚本时,我得到:

任务中使用的类型类net.sf.antcontrib.logic.ForTask无效,它没有公共迭代器方法


我正在使用ant contrib 1.0b3。我在这里遗漏了什么?

无法重现您的问题。你使用的是什么版本的ANT

例子 编译文件

注:

  • 特殊的“引导”目标安装ant contrib依赖项
  • 确保
    {ant_HOME}\lib
    目录中存在
    antcontrib 1.0b3.jar
  • 确保这两行位于
    build.xml
    文件的顶部

  • 我忘了。。。我只是做了同样的事情(为循环嵌套,没有想到用一个连续的循环来包装内部循环)。你应该把它作为一个答案,并允许它被提升…我几乎忽略了这个评论。
    $ 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
    
    <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>