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 &quot;cd ../project1 &amp;&amp; ant copy_to_project2_lib &quot; "/>
</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)的更多相关文章

  1. 通过ant调用shell脚本执行adb命令

    在Hudson或者Jenkins中利用ant的exec 来调用shell命令,通过shell脚本来执行adb shell命令,可以正常执行,不会出现在ant中直接调用adb shell出现的假死情况. ...

  2. iTOP-开发板-MiniLinux-C程序调用shell命令

    本文档介绍的是在 linux 系统环境下 linux-C 调用 shell 命令实验步骤,和文档压缩包一起的“iTOP-开发板-MiniLinux-SHELL_V1.0.zip”是 c 程序源码.Li ...

  3. awk 调用 shell 命令,并传递参数

    from:awk 调用 shell 命令的两种方法:system 与 print shell 向awk传递命令,这样使用即可: awk -v  ...  但反过来呢?awk调用外部命令,同时也传参呢? ...

  4. awk调用shell命令的两种方法:system与print

    from:http://www.oklinux.cn/html/developer/shell/20070626/31550.htmlawk中使用的shell命令,有2种方法: 一.使用所以syste ...

  5. python 调用 shell 命令方法

    python调用shell命令方法 1.os.system(cmd) 缺点:不能获取返回值 2.os.popen(cmd) 要得到命令的输出内容,只需再调用下read()或readlines()等   ...

  6. Awk中调用shell命令

    Awk中调用shell命令 需求 在awk中,有时候需要调用linux系统中命令,如计算字符串的MD5值,并保存下来. 方法参考 call a shell command from inside aw ...

  7. 【转载】如何在C语言中调用shell命令

    转载自:http://blog.csdn.net/chdhust/article/details/7951576 如何在C语言中调用shell命令 在linux操作系统中,很多shell命令使用起来非 ...

  8. python 调用shell命令三种方法

    #!/usr/bin/python是告诉操作系统执行这个脚本的时候,调用/usr/bin下的python解释器: #!/usr/bin/env python这种用法是为了防止操作系统用户没有将pyth ...

  9. python 调用shell命令的方法

    在python程序中调用shell命令,是件很酷且常用的事情…… 1. os.system(command) 此函数会启动子进程,在子进程中执行command,并返回command命令执行完毕后的退出 ...

随机推荐

  1. [bzoj3196][Tyvj 1730][二逼平衡树] (线段树套treap)

    Description 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 1.查询k在区间内的排名 2.查询区间内排名为k的值 3.修改某一位值上的数值 4.查询k在 ...

  2. Windows API 之 VirtualAlloc

    Reserves, commits, or changes the state of a region of pages in the virtual address space of the cal ...

  3. LeetCode OJ 337. House Robber III

    The thief has found himself a new place for his thievery again. There is only one entrance to this a ...

  4. hud 2099

    #include <stdio.h> #include <stdlib.h> int main() { int m,n,i,flag; ) { flag=; && ...

  5. Software Version

    Software Version Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) To ...

  6. 还在纠结 Flux 或 Relay,或许 Redux 更适合你

    重磅消息,Redux 1.0 发布,终于可以放心用于生产环境了! 在这个端应用技术膨胀的时代,每天都有一大堆框架冒出,号称解决了 XYZ 等一系列牛 X 的问题,然后过一段时间就不被提起了.但开发的应 ...

  7. Android Studio 如何将包名按层级展示

    在project视图右上角有个“设置”的按钮,点开,然后将上图所圈部分去勾选就可以了.

  8. think in uml-关系

    1.关联关系association 在一段时间内将多个类的实例连接在一起 某个对象在一段时间内一直"知道"另一个对象的存在 2.依赖关系dependency 一个对象的修改会导致另 ...

  9. UITextfield的一些属性

    //设置左视图 不用设置frame UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quo ...

  10. Intersecting Lines POJ 1269

    题目大意:给出两条直线,每个直线上的两点,求这两条直线的位置关系:共线,平行,或相交,相交输出交点. 题目思路:主要在于求交点 F0(X)=a0x+b0y+c0==0; F1(X)=a1x+b1y+c ...