Apache Ant - Intellij Idea社区不承认循环命令

时间:2016-03-14 12:52:53

标签: intellij-idea ant ant-contrib

我想创建一个for循环来迭代文件的行。 我做了:

<loadfile property="download.file" srcfile="download_list.txt"/>

<target name="criarArvore">
    <mkdir dir="${download.dir}"/>
    <mkdir dir="${domain.dir}"/>
</target>

<target name="download" depends="criarArvore">
    <for param="line" list="${download.file}" delimiter="${line.separator}">
        <sequential>
            <echo>@{line}</echo>
        </sequential>
    </for>
</target>

但在<for> intellij警告我:&#39;无法解析符号&#34;对于&#34;&#39;。 当我运行脚本时,我收到:

c:\xxx\build.xml:22: Problem: failed to create task or type for
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

1 个答案:

答案 0 :(得分:1)

<for> task来自第三方Ant-Contrib library

要使用Ant-Contrib,请下载ant-contrib-1.0b3-bin.zip,从中提取ant-contrib-1.0b3.jar,然后按照how to install Ant-Contrib上的说明操作。