访问包含的ant文件中的项目前缀
是否可以访问包含的ant文件中的“as”前缀 (即访问包含任务中指定的“as”属性值) 文件include.xml:访问包含的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
<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