Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant包含文件多次覆盖目标_Ant_Include_Targets - Fatal编程技术网

Ant包含文件多次覆盖目标

Ant包含文件多次覆盖目标,ant,include,targets,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 name="test_includer">
  <include file="testbuild_import.xml" as="A" optional="false"/>
  <include file="testbuild_import.xml" as="B" optional="false"/>
</project>
我不知道为什么最后一个前缀是B。只有3个目标,所有目标都有A前缀。如果我使用9个目标,那么目标3、4、5的前缀为A,其他的前缀为B。在我看来,这是很随意的

我预计总共会得到8个目标,4个前缀为A,4个前缀为B


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

这看起来像是ant中的一个bug,我已经打开了,非常感谢你的努力@StefanBodewig。
<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>
Main targets:
 A.target1  test target 1
 A.target2  test target 2
 A.target3  test target 3
 B.target4  test target 4
Other targets: