for task

The ModelAnt’s util package provides for task iterates over a collection of objects, provided as a nested selector (like ANT standard <fileset>), and executes the nested tasks in a new separate (local) environment, binding in it the current object to process into a local property. The execution of each iteration in a single environment isolates the changes they make. The name to bind the current object is provided in iterator attribute (default: this).

See the documentation of for task.

For example, when run in  modelant/util/test/xml directory, this fragment:

<for>
  <fileset dir=".">
    <include name="*.xml"/>
  </fileset>

  <tasks>
    <echo>${this}</echo>
  </tasks>
</for>

produces the output:

[echo] test-dynamic.xml
[echo] test-eval.xml
[echo] test-exists.xml
[echo] test-filter.xml
[echo] test-if.xml
[echo] test-list.xml
[echo] test-local.xml
[echo] test-method.xml
[echo] test-search.xml
[echo] test-select.xml

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.