依赖关系不是有序的,它们是分层的。如果同一层次结构中的两个依赖项以不需要的顺序运行,只需让一个依赖于另一个即可。
在你的情况下,你可以说
compile-generated
依靠您的共享
compile
的依赖项。
在共享生成中。xml:
<target name="compile" depends="copy-dependlib-jars,prepare-staging-dirs">
<echo message="Running root.compile" />
</target>
<target name="copy-dependlib-jars">
<echo message="Running copy-dependlib-jars" />
</target>
<target name="prepare-staging-dirs">
<echo message="Running prepare-staging-dirs" />
</target>
自定义生成。xml:
<import file="build.xml" />
<target name="compile" depends="compile-generated,root.compile">
<echo message="Running custom compile" />
</target>
<target name="compile-generated" depends="copy-dependlib-jars,prepare-staging-dirs">
<echo message="Running compile-generated" />
</target>
ant编译
copy-dependlib-jars:
[echo] Running copy-dependlib-jars
prepare-staging-dirs:
[echo] Running prepare-staging-dirs
compile-generated:
[echo] Running compile-generated
root.compile:
[echo] Running root.compile
compile:
[echo] Running custom compile