如何多次执行ant任务?

如何多次执行ant任务?,ant,build-automation,Ant,Build Automation,将此想象为build.xml中的代码: <project name="test project"> <target name="first"> <echo>first</echo> </target> <target name="second" depends="first"> <echo>second</echo> </targe

将此想象为build.xml中的代码:

<project name="test project">
    <target name="first">
        <echo>first</echo>
    </target>
    <target name="second" depends="first">
        <echo>second</echo>
    </target>
    <target name="third" depends="first,second">
        <echo>third</echo>
    </target>
</project>
我将收到以下输出:

first,first,second,third

换句话说,我希望每个依赖项都能运行,不管它以前是否运行过。

这不是依赖项的用途

如果您需要这种行为,请使用或

first,first,second,third
<project name="test project">
    <target name="first">
        <echo>first</echo>
    </target>
    <target name="second">
        <antcall target="first" />
        <echo>second</echo>
    </target>
    <target name="third">
        <antcall target="first" />
        <antcall target="second" />
        <echo>third</echo>
    </target>
</project>
> ant third
Buildfile: build.xml

third:

first:
     [echo] first

second:

first:
     [echo] first
     [echo] second
     [echo] third

BUILD SUCCESSFUL
Total time: 0 seconds