function installant() {
# get the latest version number
antversion=$(wget -O - "http://ant.apache.org/bindownload.cgi" 2>&1| grep "is the best available version" | sed 's/.*Currently, Apache Ant //g' | sed 's/ is the best a.*//g')
if [ -z "$antversion" ]; then
antversion=1.6.5
fi
cd /usr/local
wget -O - "http://mirror.cc.columbia.edu/pub/software/apache/ant/binaries/apache-ant-$antversion-bin.tar.gz" |
tar xz
if [ $? -ne 0 ]; then
echo "Failed getting ant binary from 'http://mirror.cc.columbia.edu/pub/software/apache/ant/binaries/apache-ant-$antversion-bin.tar.gz'" >&2
return 1
fi
if [ -e /usr/local/apache-ant ]; then
mv /usr/local/apache-ant /usr/local/old.apache-ant
fi
mv /usr/local/apache-ant-$antversion /usr/local/apache-ant
echo 'export ANT_HOME=/usr/local/apache-ant
export PATH=$PATH:/usr/local/apache-ant/bin' > /etc/profile.d/ant.sh
chmod +x /etc/profile.d/ant.sh
/usr/local/apache-ant/bin/ant -version
}
installant
people came here from: