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. leetcode409

    Given a string which consists of lowercase or uppercase letters, find the length of the longest pali ...

  2. getTime 方法

    转自http://www.yesky.com/imagesnew/software/javascript/html/jsmthgettime.htm getTime 方法返回 Date 对象中的时间值 ...

  3. C++ 中 const和define的区别

    来源网址:http://wujiangping.blog.163.com/blog/static/195182011201255115125205/ 请区别用#define命令定义的符号常量和用con ...

  4. IE下单选按钮隐藏后点击对应label无法选中的bug解决

    项目中,有时候填写表单我们的选项会隐藏掉radio或者checkbox,而只显示给用户对应的文字选择,如果用户点击label选择时,在FF/Chrome等标准浏览器中隐藏掉的radio/checkbo ...

  5. Inno Setup入门(十一)——完成安装后执行某些程序

    有些时候我们的程序虽然能够很好的完成安装,但是程序的配置工作可能需要其他的一些程序来辅助完成,如果不执行这些程序,主程序就不能很好的完成工作,甚至不能完成工作,一个很明显的例子是,目前许多程序是通过N ...

  6. mongodb移除分片

    MongoDB的Shard集群来说,添加一个分片很简单,AddShard就可以了. 但是缩减集群(删除分片)这种一般很少用到.由于曙光的某服务器又挂了,所以我们送修之前必须把它上面的数据自动迁移到其他 ...

  7. ubuntu setup adb tool

    sudo add-apt-repository ppa:nilarimogard/webupd8sudo apt-get updatesudo apt-get install android-tool ...

  8. isr

    Kafaka动态维护了一个同步状态的副本的集合(a set of in-sync replicas),简称ISR

  9. 文件系统满的话(filesystem full),该如何处理。

    #!/bin/bash function ergodic(){ ` do "/"$file ] then ergodic $"/"$file else loca ...

  10. 编译使用tinyxml

    环境: win7 32位旗舰版,VS2010,tinyxml_2_6_2版本 1.下载tinyxml,并解压到tinyxml文件夹下 2.生成动态链接库 原生的Tinyxml只支持静态库(没有在.h文 ...