1.一键安装Ant的shell脚本:
#!/bin/bash
#apt-get update
#apt-get install zip unzip
wget -Pwget -P /opt https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/ant/apache-ant-1.10.3-bin.zip
unzip /opt/apache-ant-1.10.3-bin.zip -d /opt/
#set environment
export ANT_HOME="/opt/apache-ant-1.10.3"
if ! grep ANT_HOME="/opt/apache-ant-1.10.3" /etc/profile
then
echo "ANT_HOME=/opt/apache-ant-1.10.3" | sudo tee -a /etc/profile
echo "export ANT_HOME" | sudo tee -a /etc/profile
echo "PATH=${ANT_HOME}/bin:$PATH" | sudo tee -a /etc/profile
echo "export PATH" | sudo tee -a /etc/profile
fi
source /etc/profile
sudo ln -s /opt/apache-ant-1.10.3/bin/ant /usr/local/bin/ant
ant -version
echo "install ant is ok !!!"
3.用法:
3.1.wget下载shell脚本
#code
wget https://coding.net/u/jamesz2011/p/ubuntu_lib1/git/raw/master/ant/install_ant.sh
3.2.chmod赋予“可运行”权限
#code
chmod a+x install_ant.sh
3.3.source运行install_ant.sh脚本
#code
source install_ant.sh
4.一键安装Ant成功的标志:
#code
#ant -version 验证Ant是否安装配置成功
ant -version