mac(linux) 上如何安装ant

1、从http://ant.apache.org/srcdownload.cgi下载ant (用ant src编译后装)

2、解压下载下来的内容到一个文件夹,打开终端先进入到刚才解压后的文件夹如:cd /Downloads/apache-ant-1.9.6 然后执行编译ant 命令为 sh build.sh -Ddist.dir=<directory_to_contain_Ant_distribution> dist

3、第二步骤成功的话在刚才进入的那个目录底下会有一个bootstrap目录,这个目录中包含了ant所需的 bin 和 lib

4、配置环境变量:a 、在bash.profile文件中加入环境变量 export ANT_HOME="/Library/Ant" 在export Path="/opt/local/bin:/opt/local/sbin:$PATH"的$PATH加上/Library/Ant/bin: 这样你就能够让系统知道你的Ant的home directory 在Library/Ant/bin目录

5、验证:在终端输入 ant 出现 以下提示

输出: Buildfile: build.xml does not exist!

    Build failed

输入 ant -version 

输出:  Apache Ant(TM) version 1.9.6 compiled on March 31 2016

 

这样就OK了! 

 

6、

在ANT_HOME下输入ant -f fetch.xml -Ddest=system获取ant所需的jar包

 

posted on 2016-03-31 16:19  码农时刻  阅读(323)  评论(0编辑  收藏  举报