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 - Fatal编程技术网

访问包含的ant文件中的项目前缀

访问包含的ant文件中的项目前缀,ant,Ant,是否可以访问包含的ant文件中的“as”前缀 (即访问包含任务中指定的“as”属性值) 文件include.xml: <project name="myproject"> <include file="included.xml" as="nested" /> </project> 文件included.xml: <project> <echo message="I am included into ${ant.project.n

是否可以访问包含的ant文件中的“as”前缀 (即访问包含任务中指定的“as”属性值)

文件include.xml:

<project name="myproject">
  <include file="included.xml" as="nested" />
</project>

文件included.xml:

<project>
  <echo message="I am included into ${ant.project.name} as ${SomePropertyIAskAbout}" />
</project>

所需的输出:“我作为嵌套项包含在我的项目中”

执行包含的构建文件,就像在包含的构建文件中一样。让两个文件都引用一个自定义属性就可以了

包括.xml
<project name="myproject">
    <property name="including-as-attribute" value="nested" />
    <include file="included.xml" as="${including-as-attribute}" />
</project>
<project>
    <fail unless="including-as-attribute"/>
    <echo message="I am included into ${ant.project.name} as ${including-as-attribute}" />
</project>
 [echo] I am included into myproject as nested