简体   繁体   English

在centos上安装Apache Ant 1.8.4

[英]installing Apache Ant 1.8.4 on centos

I want to install apache ant1.8.4 on my centos machine. 我想在我的centos机器上安装apache ant1.8.4 I've read in the apache website but i didn't really understand how should i do tha. 我已经在apache网站上阅读了,但是我不太了解该怎么办。 I didn't find the package on their website. 我在他们的网站上找不到该软件包。 Is there any option to use the yum install command? 是否可以使用yum install命令?

Assuming you already have jdk installed, you could do the following: 假设您已经安装了jdk,则可以执行以下操作:

cd $HOME
wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.2-bin.tar.gz
tar xvfvz apache-ant-1.9.2-bin.tar.gz
In .bash_profile, add the following line
ANT_HOME=$HOME/apache-ant-1.9.2
PATH=$PATH:$ANT_HOME/bin
. ./.bashrc_profile
ant -version ##you should see version of ant.

(updated to 1.9.2 for wget) (已将wget更新为1.9.2)

There may be a way of installing Ant as a package. 可能有一种将Ant作为软件包安装的方法。 On the Apache Ant website, you do it manually. 在Apache Ant网站上,您可以手动进行操作。 The tarball or zip provided has the entire Ant package installed. 提供的tarball或zip已安装了整个Ant软件包。 It's not that difficult: 并不困难:

  • Unzip or untar it to a special directory like /opt . 将其解压缩或解压缩到/opt这样的特殊目录。 I install all third party stuff in /opt on my system. 我在系统上的/opt安装了所有第三方内容。 Everything in the zip or tarball will be under the apache-ant-1.8.4 directory, so Ant will be under /opt/apache-ant-1.8.4 . zip或tarball中的所有内容都将位于apache-ant-1.8.4目录下,因此Ant将位于/opt/apache-ant-1.8.4下。
  • In your .profile , set $ANT_HOME to where Ant was installed ( /opt/apache-ant-1.8.4 in the above example. Then, add $ANT_HOME/bin to your $PATH . .profile ,将$ANT_HOME设置$ANT_HOME Ant的安装位置(在上面的示例中为/opt/apache-ant-1.8.4 。然后,将$ANT_HOME/bin添加到$PATH
  • Or, my preference, symbolically link all programs under /opt/apache-ant-1.8.4/bin to the /usr/local/bin directory and put that directory in the front of your PATH. 或者,按我的喜好,将/opt/apache-ant-1.8.4/bin下的所有程序象征性地链接到/usr/local/bin目录,并将该目录放在PATH的前面。 This allows you to put all specially installed executables in one directory that can be placed in your $PATH . 这使您可以将所有特别安装的可执行文件放在一个目录中,该目录可以放在$PATH

That's about it. 就是这样 If you have the Ant executable (It's a shell script on Unix/Linux/Mac, and a batch script called ant.bat on Windows) in your PATH, it should work. 如果您的PATH中有Ant可执行文件(在Unix / Linux / Mac上是shell脚本,在Windows上是名为ant.bat的批处理脚本),则它应该可以工作。

You mentioned you didn't have the Java Development Kit (JDK) installed. 您提到您没有安装Java开发工具包(JDK)。 This must be installed first since Ant is a Java program. 由于Ant是Java程序,因此必须首先安装它。 There must be a CENTOS package for Java. 必须有一个用于Java的CENTOS软件包。 If not, you can try http://java.com/en/download/manual.jsp to download Java on your system. 如果没有,您可以尝试http://java.com/en/download/manual.jsp在系统上下载Java。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM