[ start | index | login ]
start > knowledgebase > linux > java > ant install

ant install

Created by retep. Last edited by kron, one year and 268 days ago. Viewed 2,745 times. #6
[diff] [history] [edit] [rdf]
labels
attachments

Cut and Paste Ant Install Script

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
请以发表评论身份登录
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.