1。下載 下載地址:http://ant./bindownload.cgi 下載apache-ant-1.8.1-bin.tar.gz(當(dāng)前最新版本),,將該下載包拷貝到/usr/local下(隨意了,,找個地方就好) 2。解壓 cd /usr/local tar -zxvf apache-ant-1.8.1-bin.tar.gz 解壓后會在/usr/local 下生成一個文件夾apache-ant-1.8.1 3,。配置環(huán)境變量 (ant是基于java的,,所以要先確保系統(tǒng)中已經(jīng)安裝了jdk) vi /etc/profile,如下所示 - # System wide environment and startup programs, for login setup
- # Functions and aliases go in /etc/bashrc
- JAVA_HOME=/usr/java/jdk
- JAVA_BIN=/usr/java/jdk/bin
- PATH=$JAVA_HOME/bin:$PATH
- CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- export JAVA_HOME JAVA_BIN PATH CLASSPATH
- 以下省略……
添加如下內(nèi)容: - ANT_HOME=/usr/local/apache-ant-1.8.1
-
- PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
- export JAVA_HOME JAVA_BIN ANT_HOME PATH CLASSPATH
修改后如下所示: - # System wide environment and startup programs, for login setup
- # Functions and aliases go in /etc/bashrc
- JAVA_HOME=/usr/java/jdk
- JAVA_BIN=/usr/java/jdk/bin
- ANT_HOME=/usr/local/apache-ant-1.8.1
- PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
- CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- export JAVA_HOME JAVA_BIN ANT_HOME PATH CLASSPATH
cd /usr/bin ln -s -f /usr/local/ant/bin/ant 運行ant -version,,輸出如下內(nèi)容: [root@localhost ~]# ant -version Apache Ant version 1.8.1 compiled on April 30 2010 ok,,ant配置完成。
|