我想创建一个 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警告我:"无法解析符号'为'"。当我运行脚本时,我收到:
c:xxxbuild.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.
<for>
任务来自第三方 Ant-Contrib 库。
.zip,从中提取 ant-contrib-1.0b3.jar,然后按照有关如何安装 Ant-Contrib 的说明进行操作。