ant调用shell命令(Ubuntu)
ant中调用Makefile,使用shell中的make命令
<?xml version="1.0" encoding="utf-8" ?>
<project name="dy_cike_init" basedir=".">
<target name="hait_cpr" description="">
<exec executable="/bin/sh">
<arg line="-c make -f /home/test/ant/Makefile"/>
</exec>
</target>
</project>
使用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 指定的命令,然后停止。
http://blog.csdn.net/samlei/article/details/4231496
<project name="maketest" default="mk">
<target name="mk" >
<exec dir="/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest" executable="make" os="Linux" failonerror="true">
</exec>
        </target>
</project>
而我们的makefile文件简单如下:
targets:
                @echo "hello make!"
                pwd
                du
@echo "test is ok!">>/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest/test.txt
按照build.xml文件,ant将会执行make命令。
结果如下:
[root@localhost maketest]# ant
Buildfile: build.xml
mk:
     [exec] hello make!
     [exec] pwd
     [exec] /ci/opt/cruisecontrol-bin-2.7.3/projects/maketest
     [exec] du
     [exec] 16  .
BUILD SUCCESSFUL
Total time: 1 second
[root@localhost maketest]#
我们可以看到ant已经成功执行,并输出了makefile的结果。这里提醒大家的是,ant在执行过程中对语法错误的检测是相当宽松的,所以我们看到ant “build successful”的语句并不一定说明ant语句没有问题。
ant调用shell命令(Ubuntu)的更多相关文章
- 通过ant调用shell脚本执行adb命令
		
在Hudson或者Jenkins中利用ant的exec 来调用shell命令,通过shell脚本来执行adb shell命令,可以正常执行,不会出现在ant中直接调用adb shell出现的假死情况. ...
 - iTOP-开发板-MiniLinux-C程序调用shell命令
		
本文档介绍的是在 linux 系统环境下 linux-C 调用 shell 命令实验步骤,和文档压缩包一起的“iTOP-开发板-MiniLinux-SHELL_V1.0.zip”是 c 程序源码.Li ...
 - awk 调用 shell 命令,并传递参数
		
from:awk 调用 shell 命令的两种方法:system 与 print shell 向awk传递命令,这样使用即可: awk -v ... 但反过来呢?awk调用外部命令,同时也传参呢? ...
 - awk调用shell命令的两种方法:system与print
		
from:http://www.oklinux.cn/html/developer/shell/20070626/31550.htmlawk中使用的shell命令,有2种方法: 一.使用所以syste ...
 - python 调用 shell 命令方法
		
python调用shell命令方法 1.os.system(cmd) 缺点:不能获取返回值 2.os.popen(cmd) 要得到命令的输出内容,只需再调用下read()或readlines()等 ...
 - Awk中调用shell命令
		
Awk中调用shell命令 需求 在awk中,有时候需要调用linux系统中命令,如计算字符串的MD5值,并保存下来. 方法参考 call a shell command from inside aw ...
 - 【转载】如何在C语言中调用shell命令
		
转载自:http://blog.csdn.net/chdhust/article/details/7951576 如何在C语言中调用shell命令 在linux操作系统中,很多shell命令使用起来非 ...
 - python 调用shell命令三种方法
		
#!/usr/bin/python是告诉操作系统执行这个脚本的时候,调用/usr/bin下的python解释器: #!/usr/bin/env python这种用法是为了防止操作系统用户没有将pyth ...
 - python 调用shell命令的方法
		
在python程序中调用shell命令,是件很酷且常用的事情…… 1. os.system(command) 此函数会启动子进程,在子进程中执行command,并返回command命令执行完毕后的退出 ...
 
随机推荐
- H5的新应用-使用Web Worker为学生考试计时
			
-------------------------- <script type="text/javascript"> //初始化函数 ...
 - echo json数据给ajax后, 需要加上exit,防止往下执行,带上其他数据,到时ajax失败
			
01返回json数据给ajax后需要加上exit.返回json数据前不能有其他输出 function apply(){ if(IS_POST){$info['status'] = 1; echo js ...
 - 1. 用自己的算法实现startsWith和endsWith功能。
			
package com.xinjian; public class Chazifu { public static void main(String[] args) { String a=" ...
 - 笨方法学python--简介
			
该章提到编程新手所需的三种最重要的技术:读和写,注重细节,发现不同. 读 和 写 即熟悉代码中的各种字符. 注 重 细 节 将例子一字不差地打出来,通过实践训练自己 发 现 不 同 这个是通过长年累月 ...
 - POJ 2031 Building a Space Station 最小生成树模板
			
题目大意:在三维坐标中给出n个细胞的x,y,z坐标和半径r.如果两个点相交或相切则不用修路,否则修一条路连接两个细胞的表面,求最小生成树. 题目思路:最小生成树树模板过了,没啥说的 #include& ...
 - A convenient way of installing(compiling) VIM with YCM
			
Ah, while I am still downloading LLVM from github(very slow.. and very large in size). I come with m ...
 - F(k)<(维护+枚举)\(找规律+递推+枚举)>
			
题意 小明有一个不降序列(f(1),f(2),f(3),--),f(k)代表在这个序列中大小是k的有f(k)个.我们规定f(n)的前12项如下图. n 1 2 3 4 5 6 7 8 9 10 11 ...
 - iOS拨打电话(三种方法)
			
iOS拨打电话(三种方法) 查了很多地方的关于iOS程序拨打电话,大都不全,今天我总结了三种方法,各有不同,拿来给大家分享,希望给大家有所帮助 1,这种方法,拨打完电话回不到原来的应用,会停留在通讯 ...
 - [转]LayoutInflater的inflate函数用法
			
LayoutInflater作用是将layout的xml布局文件实例化为View类对象. 获取LayoutInflater的方法有如下三种: LayoutInflater inflater=(Layo ...
 - img图片inline-block总结
			
<div style="font-size:0;"> <img data-src="http://image.zhangxinxu.com/image/ ...