Ant包含文件不止一次覆盖目标

时间:2017-03-03 21:51:30

标签: ant include targets

根据描述:

  

导入与包含有何不同? [...]   通过使用不同的前缀可以多次包含同一个文件,不可能多次导入同一个文件。

但我无法弄清楚如何做到这一点。我认为它应该像这样工作:

包容者:

<project name="test_includer">
  <include file="testbuild_import.xml" as="A" optional="false"/>
  <include file="testbuild_import.xml" as="B" optional="false"/>
</project>

包括:

<project name="test_include">
  <target name="target1" description="test target 1">
    <echo>I'm a target</echo>
  </target>

  <target name="target2" description="test target 2">
    <echo>I'm a target too</echo>
  </target> 

  <target name="target3" description="test target 3">
    <echo>I'm a target too</echo>
  </target>

  <target name="target4" description="test target 4">
    <echo>I'm a target too</echo>
  </target>
</project>

ant -projecthelp -buildfile testbuild.xml的输出如下:

Main targets:
 A.target1  test target 1
 A.target2  test target 2
 A.target3  test target 3
 B.target4  test target 4
Other targets:

我没有任何线索为什么最后一个得到B前缀。只有3个目标,所有目标都有A前缀。如果我使用9个目标,则目标3,4,5获得A前缀,其他目标为B前缀。在我看来这很随意。

我希望总共有8个目标,4个带有A前缀,4个带有B前缀。

如果有人能给我一个提示怎么做,或者至少解释发生了什么以及为什么它不起作用,我会很高兴。

0 个答案:

没有答案
相关问题