Installation and configuration of ANT in ubuntu

Installation and configuration of ANT in ubuntu

1. Can be used

    sudo apt-get install ant

installed, but this way of installation is not good. The ant installed first is not the latest version, and secondly, a bunch of other incidental things are installed. So I just use my own manual ant installation.

2. Manual installation

    1. Go to the Apache official website to download the latest version of ant: http://ant.apache.org/bindownload.cgi

    2. Unzip the downloaded.tar.gz文件: tar -xf apache-ant-1.8.2-bin.tar.gz (可能会要求输入密码)

  3.将解压出来的文件移动到/opt/下:sudo mv apache-ant-1.8.2 /opt/ (sudo 不能省,否则没有权限)

  4.配置环境变量:sudo gedit /etc/profile,在原来基础上添加以下蓝体字:

     export ANT_HOME=/opt/apache-ant-1.8.2
     export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
     export PATH=$JAVA_HOME/bin:$PATH:$ANT_HOME/bin
     export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    5. Verify that the installation was successful: ant -version

    Apache Ant(TM) version 1.8.2 compiled on December 20 2010
    This means the installation is successful!

The specific usage method can be learned one by one using ant --help.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326879908&siteId=291194637