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命令执行完毕后的退出 ...
随机推荐
- Android软件盘InputMethodManager
调用下面代码:(第一次调用显示,再次调用则隐藏,如此反复),this指activity InputMethodManager imm = (InputMethodManager)this.getSys ...
- 第四十一节,xml处理模块
XML是实现不同语言或程序之间进行数据交换的协议,XML文件格式如下 读xml文件 <data> <country name="Liechtenstein"> ...
- 第十六节,基本数据类型,字典dict
字典 常用操作: 索引 新增 删除 键.值.键值对 循环 长度 字典由键值对组成,由一个键(名称)和 一个值组成,与列表和元组不同的是里面的元素是有键的(名称) 所以当要打印字典时,打印字典变量加[键 ...
- 更改web project 访问项目名称
1.新建web project 2.右键该项目名称------properties 3.访问该项目的URL http://localhost:8806/ssm/.......... 相比书写整个项目名 ...
- Ubuntu 下安装 nfs
1先安装sudo apt-get install nfs-kernel-server(安装nfs-kernel-server时,apt会自动安装nfs-common和portmap) 分开看就是1.服 ...
- android,view的执行过程onDraw、onSizeChanged,onFinishInflate
小试view的执行过程,此是入门,高手绕道. ----------------------------------------------------------------------------- ...
- jsp提交表单问题
以form形式提交的话 String usernameInForm = hreq.getParameter("username");String passwordInForm = ...
- ignite中的sql查询
ignite中进行sql查询需要对要查询的cache和字段进行配置,可以在xml中配置,也可以在代码中配置或进行注解,我用的是xml配置: <!-- 配置cache --> <pro ...
- iOS NSString类中获取子字符串
NSString类中提供了这样三个方法用于获取子字符串: – substringFromIndex://取字符串长度从0开始,当index=str.length时字符串为空"" – ...
- Got Stucked in C++ Static Library Loading.. for some time
I used to load library using 1 single .dll file, so when I happen to do method calling between 2 pro ...