如何在build.xml中根据参数调用另一个xml文件

3
我有三个XML文件,分别是build.xml, build_1.xml和build_2.xml。其中build_1.xml和build_2.xml文件中都有名为'compress'的目标。
如何配置build.xml文件,以便在调用'ant compress 1'时运行build_1.xml文件中的压缩目标,并在调用'ant compress 2'时相应地运行build_2.xml中的压缩目标?

通过 depends="" 我们可以选择其他的 XML 目标。 - Aquarius Power
1个回答

5

请参阅https://ant.apache.org/manual/Tasks/ant.html

根据我理解您的问题,您需要在build.xml文件中添加以下两个目标:

<target name="ant compress 1">
    <ant antfile="build_1.xml" target="compress"/>
</target>

<target name="ant compress 2">
    <ant antfile="build_2.xml" target="compress"/>
</target>

在build.xml的另一个目标中创建“ant compress 1”的调用方式有吗? - Aquarius Power
我最终导入了该文件并使用了 depends。http://stackoverflow.com/a/25207678/1422630 - Aquarius Power

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接