使用ANT从属性中拆分值

使用ANT从属性中拆分值,ant,foreach,Ant,Foreach,我有以下代码: <dirset id="aa" dir="FOLDER" includes="example*" excludes=".*"> </dirset> <pathconvert pathsep="," property="bb" refid="aa"> <mapper type="flatten"/> </pathconvert> <echo message="LIST:${bb}"/> 输出例如'e

我有以下代码:

<dirset id="aa" dir="FOLDER" includes="example*" excludes=".*">
</dirset>
<pathconvert pathsep="," property="bb" refid="aa">
<mapper type="flatten"/> 
</pathconvert>  
<echo message="LIST:${bb}"/>

输出例如'examle.aa,example.bb'


我想为每个示例调用另一个目标。*。。您能帮助我吗?

宏定义可以用于此操作,您可以基于当前属性使用自定义属性或元素调用它:

尝试循环功能。这里有一个例子

<project>

    <target name="test">
        <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="./lib/ant-contrib-1.0.jar" />

        <for param="file">
            <dirset dir="." />

            <sequential>
                <task dir="@{file}" />
            </sequential>
        </for>
    </target>


    <macrodef name="task">
        <attribute name="dir" />

        <sequential>
            <echo>@{dir}</echo>
        </sequential>
    </macrodef>

</project>

@{dir}