Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

antcall in foreach is not executing loop

I want to build couple of projects based on no of .composites by using ant scripts. i added all the taskref tags,lib path every thing in my build.xml file. i wrote the following piece of code for the same and i am getting the error foreach doesn't support the nested "antcall" element.

<target name="createApplicationDAA">
<foreach param="program">
    <path>
        <fileset dir="${soaProjectName}/Composites" includes="**/*.composite"/>
    </path>
    <antcall target="createDAA"/>
</foreach>
</target>
<target name="createDAA">
..........
....
</target>

clearly, my requirement is to create all DAAs by building all the composites by using foreach or for loop in ant script. can anybody please let me know,where am i doing wrong?

like image 246
ktraos Avatar asked Jan 23 '26 06:01

ktraos


1 Answers

foreach doesn't use nested elements to determine what to run, it takes a target attribute:

<target name="createApplicationDAA">
  <foreach param="program" target="createDAA">
    <path>
      <fileset dir="${soaProjectName}/Composites" includes="**/*.composite"/>
    </path>
  </foreach>
</target>
<target name="createDAA">
  <echo>${program}</echo>
</target>

Alternatively, use <for>, which takes a nested <sequential>

<target name="createApplicationDAA">
  <for param="program">
    <path>
      <fileset dir="${soaProjectName}/Composites" includes="**/*.composite"/>
    </path>
    <sequential>
      <echo>@{program}</echo>
    </sequential>
  </for>
</target>
like image 134
Ian Roberts Avatar answered Jan 25 '26 19:01

Ian Roberts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!