ant中调用外部ant任务的两种方法
2013-09-01 10:51
253 查看
原文地址: http://blog.csdn.net/samlei/article/details/4231496在ant脚本中对外部ant任务的调用,在多项目管理中特别有用。两种方法总结一下:使用antfile、使用exec 一:使用antfile <target name="copy_lib" description="Copy library files from project1 to project2">
<ant antfile="build.xml"
dir="${project1dir}"
inheritall="false"
inheritrefs="false"
target="copy_to_project2_lib"
/>
</target> antfile表示子项目的构建文件。
dir表示构建文件所再的目录,缺省为当前目录。inheritall表示父项目的所有属性在子项目中都可使用,并覆盖子项目中的同名属性。缺省为true。
inheritrefs表示父项目中的所有引用在子项目中都可以使用,并且不覆盖子项目中的同名引用。缺省为false。
如果在ant任务中显示的定义引用,如上例<reference refid="filter.set">则该引用将会覆盖子项目中的同名引用。
target表示所要运行的子项目中的target,如果不写则为缺省target。 二:使用exec <target name="copy_lib" description="Copy library files from project1 to project2">
<exec executable="cmd.exe">
<arg line="/c "cd ../project1 && ant copy_to_project2_lib " "/>
</exec>
</target> 翻译为命令行就是:cmd.exe /c "cd ../project && ant copy_to_project2_lib" 意思是直接调用系统控制台,先执行cd命令,再执行ant脚本指定任务,/c 表示执行后续 String 指定的命令,然后停止。
<ant antfile="build.xml"
dir="${project1dir}"
inheritall="false"
inheritrefs="false"
target="copy_to_project2_lib"
/>
</target> antfile表示子项目的构建文件。
dir表示构建文件所再的目录,缺省为当前目录。inheritall表示父项目的所有属性在子项目中都可使用,并覆盖子项目中的同名属性。缺省为true。
inheritrefs表示父项目中的所有引用在子项目中都可以使用,并且不覆盖子项目中的同名引用。缺省为false。
如果在ant任务中显示的定义引用,如上例<reference refid="filter.set">则该引用将会覆盖子项目中的同名引用。
target表示所要运行的子项目中的target,如果不写则为缺省target。 二:使用exec <target name="copy_lib" description="Copy library files from project1 to project2">
<exec executable="cmd.exe">
<arg line="/c "cd ../project1 && ant copy_to_project2_lib " "/>
</exec>
</target> 翻译为命令行就是:cmd.exe /c "cd ../project && ant copy_to_project2_lib" 意思是直接调用系统控制台,先执行cd命令,再执行ant脚本指定任务,/c 表示执行后续 String 指定的命令,然后停止。
相关文章推荐
- ant中调用外部ant任务的两种方法
- ant中调用外部ant任务的两种方法
- java 执行命令、调用bat文件、调用外部程序的两种方法
- ant调用外部ant,并变编译项目,无法找到rt.jar的处理方法
- vc弹屏的两种方法(调用外部程序)
- 两种调用外部样式的方法
- Shell中 调用/引用/包含 另外的脚本文件的两种方法
- 内部类调用外部类方法时传参的问题
- 总结C#动态调用WCF接口的两种方法
- C# 代码示例详尽剖析异步调用的两种方法
- MFC调用外部exe程序的方法
- java调用外部程序的方法
- Laravel控制器调用model的两种方法
- WCF 客户端调用服务操作的两种方法
- golang rpc的两种调用方法
- 织梦首页、列表页调用文章body内容的两种方法
- 在类外部调用类的私有方法
- 求教!内部类方法与外部类方法同名,是覆盖吗?内部类对象如何调用这个同名的外部类方法?
- java中调用dll文件的两种方法