想象一下这是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>
当我跑步时,我需要做什么:
ant third
我会收到以下输出:
first,first,second,third
换句话说,我希望每个依赖项都能运行,无论它是否已经运行过。
答案 0 :(得分:4)
这不是依赖的原因。
如果您需要这种行为,请改用antcall
或MacroDef
。
<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