Ant中调用Makefile,使用shell中的make命令
<?xml version="1.0" encoding="utf-8" ?>
<project name="my_project" basedir=".">
<target name="my_make" description="">
<exec executable="/bin/sh">
<arg line="-c make -f /home/test/ant/Makefile"/>
</exec>
</target>
</project>
<?xml version="1.0" encoding="utf-8" ?>
<project name="my_project" basedir=".">
<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>
</project>
<!-- 翻译为命令行就是:cmd.exe /c "cd ../project && ant copy_to_project2_lib" -->
意思是直接调用系统控制台,先执行cd命令,再执行ant脚本指定任务,/c 表示执行后续 String 指定的命令,然后停止。