2

I want to create a for loop to iterate over lines of a file. I did:

<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>

But at <for> intellij warns me: 'cannot resolve symbol "for"'. When I run the script I receive:

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.
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
alexpfx
  • 6,412
  • 12
  • 52
  • 88

1 Answers1

1

The <for> task is from the third-party Ant-Contrib library.

To use Ant-Contrib, download ant-contrib-1.0b3-bin.zip, extract ant-contrib-1.0b3.jar from it, and follow the instructions on how to install Ant-Contrib.

Community
  • 1
  • 1
Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
  • I cannot install ant-contrib properly. I follow the install link you pass and the official installation guide: http://ant-contrib.sourceforge.net/ and others guides I found on internet and could not make it works. It seems to be outdated as It is dated 2002 - 2003. – alexpfx Mar 14 '16 at 19:05
  • now I got it! I follow up the installation manual contained on zip file. It seems intellij don't recognize it, but the task works. – alexpfx Mar 14 '16 at 19:11