4. Import <antcall>和<marcodef>可以达到类似函数的效果,但是调用者和被调用者还是必须在同一个文件中。Ant从1.6开始引入Import Task,可以真正的实现代码重用:属性,Task 定义,Task, Macro。一个简单的例子:
<?xml version="1.0" ?>
<project>
<property name="project.name" value="Ant Modulazation" />
<target name="commonTarget">
<echo message="${test.param}" />
</target>
<macrodef name="showModule">
<attribute name="test.param" default="NOT SET"/>
<sequential>
<echo message="@{test.param}" />
</sequential>
</macrodef>
</project>
<?xml version="1.0" ?>
<project name="testCommon" default="callingTarget">
<import file="common.xml" />
<target name="callingTarget" depends="testMacro">
<antcall target="commonTarget">
<param name="test.param" value="Modulation" />
</antcall>
</target>
<target name="testMacro">
<showModule test.param="Modulation" />
</target>
</project>
运行结果如下:>ant
运行结果 写道
testMacro: [echo] Modulation callingTarget: commonTarget: [echo] Modulation
注意:在common.xml中,不能对project元素设置属性;另外,不要试图使用重名的property,或target以获取覆盖
的效果,因为Ant毕竟不是编程语言。
|
相关推荐
apache-ant-1.9.16-bin.zip
apache-ant-1.6.5-bin ant编译
ant中使用jmeter task,需要的“ant-jmeter-1.1.1.jar”jar包 放到ant的classpath下就好了
apache-ant-1.10.12-bin.tar.gz
开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ant-launcher-1.9.6开发工具 ...
apache-ant-1.9.2-bin.zip
apache-ant-1.10.1-bin.zip 【windows版,32位和64位通用】
标签:ant-apache-bcel.jar.zip,ant,apache,bcel,jar.zip包下载,依赖包
ant 安装包 新版本 可以尝试下 官网版本 apache-ant-1.10.3-bin.zip
最新版linux apache-ant-1.9.15-bin.tar.gz
apache-ant-1.10.12-bin.tar.bz2
ant-antlr-1.6.3.jarant-antlr-1.6.3.jarant-antlr-1.6.3.jarant-antlr-1.6.3.jar
vuex2.x中用于设置ant-design-vue中table组件的列宽可拖拽
标签:ant-commons-logging-1.7.0.jar,ant,commons,logging,1.7.0,jar包下载,依赖包
antdv ant-design-vue 自定义主题颜色
ant-apache-log4j-1.7.1-13.el6.i686.rpm是centos依赖包。
标签:ant-apache-bcel-1.8.2.jar,ant,apache,bcel,1.8.2,jar包下载,依赖包
标签:ant-apache-log4j-1.6.5.jar.zip,ant,apache,log4j,1.6.5,jar.zip包下载,依赖包
apache-ant-1.9.9-bin.tar.gz 【适用于linux系统,如CentOS、Ubuntu等】。
ant-designer-vue离线文档1.+版本