ubuntu中ant的安装和配置文件|ubuntu中ANT的安装和配置的例子

更新时间:2019-04-29    来源:Ubuntu    手机版     字体:

【www.bbyears.com--Ubuntu】

一. 可以使用

 代码如下

sudo apt-get install ant

安装,但是这种装法不好。首先安装的ant不是最新的版本,其次还要装一堆其他的附带的东西。所以我才用自己手动ant安装。

二. 手动安装

1. 到Apache官网下载最新版本的ant:http://ant.apache.org/bindownload.cgi

2. 解压下载下来的
.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.验证是否安装成功: ant -version

 代码如下 Apache Ant(TM) version 1.8.2 compiled on December 20 2010

如此字样,则表示安装成功!

具体的之用方法,使用 ant --help 即可一一学到。

 代码如下


# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1="h:w$ "
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1="# "
    else
      PS1="$ "
    fi
  fi
fi
ANT_HOME=/opt/apache-ant-1.8.4
PATH=/opt/arm-2010.09/bin:/opt/arm-2011.03/bin:$ANT_HOME/bin:$PATH
export ANT_HOME
export PATH

本文来源:http://www.bbyears.com/caozuoxitong/49787.html