如何在exec tast的ant脚本中更改for循环中outputproperty的值

如何在exec tast的ant脚本中更改for循环中outputproperty的值,ant,properties,exec,ant-contrib,Ant,Properties,Exec,Ant Contrib,我正在尝试更新ant脚本,以便在和执行任务的outputproperty中获得新的输出。下面是我的ant脚本 <target name="print_process_list"> <echo message="print_process_list start"/> <echo message="${compile_project_lists} "/> <echo message="print_process_list end"/&

我正在尝试更新ant脚本,以便在和执行任务的outputproperty中获得新的输出。下面是我的ant脚本

<target name="print_process_list">
    <echo message="print_process_list start"/>
    <echo message="${compile_project_lists} "/>
    <echo message="print_process_list end"/>
</target>
<target name="buildall" depends="print_process_list">
    <ac:for list="${compile_project_lists}" param="iprocess">
            <sequential>
            <exec executable="./ant_xml_pars.sh" outputproperty="ant_parstout" failonerror="false" >
                                    <arg value="@{iprocess}"/>
                            </exec>
                            <echo message="${ant_parstout} " />
        </sequential>
    </ac:for>

ant\u xml\u pars.sh根据从列表中传递的i进程给出输出。 ant_parstout获取第一次迭代输出。但是它的值对于循环中的后续迭代不会更改。 我的要求是根据作为参数传递的过程,在ant_parstout中获取输出。 我尝试了macrodef,但没有成功

我建议阅读文档并使用任务而不是ANT属性

ANT不是一种编程语言,ANT中的属性是。为了克服这些限制,有些人使用ANT的扩展,添加了“for”之类的任务。就我个人而言,我更喜欢在ANT中嵌入脚本,而不是尝试用XML编写循环

嵌入式groovy脚本示例:


这篇文章有点老了,但我也遇到了同样的问题,所以下面是我所做的:

<target name="print_process_list">
    <echo message="print_process_list start"/>
    <echo message="${compile_project_lists} "/>
    <echo message="print_process_list end"/>
</target>
<target name="buildall" depends="print_process_list">
    <ac:for list="${compile_project_lists}" param="iprocess">
            <sequential>
            <exec executable="./ant_xml_pars.sh" outputproperty="ant_parstout.@{iprocess}" failonerror="false" >
                                    <arg value="@{iprocess}"/>
                            </exec>
                            <echo message="${ant_parstout.@{iprocess}} " />
        </sequential>
    </ac:for>