7

I'm using CentOS 6.5 and installed Ant by using:

yum install ant

It came with Ant version 1.7.1, but I need the latest -- version 1.8.0.

  • How to properly get the latest Ant version 1.8.x (or higher) from YUM or any way please?

3 Answers 3

9

Awk's answer may probably work, but for some reason, it's not working for me. Then i found this (a bit different) answer by Googling.

  1. Download “bin” Release from http://ant.apache.org/bindownload.cgi
  2. Extract & copy/move the whole folder (apache-ant-1.9xxxxx) into /opt/. So there will be /opt/apache-ant-1.9xxxxxx/
  3. Make a Symlink: ln -s /opt/apache-ant-1.9.xxxxx /opt/ant
  4. Make another Symlink: ln -s /opt/ant/bin/ant /usr/bin/ant
  5. Set ANT_HOME into the Environment vi /etc/environment and add this line: ANT_HOME=/opt/ant (without trailing slash)
  6. Re-login to initiate the Environment.

That one perfectly works for me.

1
  • Works fine for me, but I didn't need to edit /etc/environment.
    – Lambart
    Commented Oct 25, 2019 at 21:07
1

The answer from 夏期劇場 works, but it has few extra steps that aren't strictly necessary. The following configuration worked for me compiling Solr.

Download and extract ant into /opt/ant

$ sudo -i
# cd /opt
# wget http://apache.parentingamerica.com//ant/binaries/apache-ant-1.9.6-bin.tar.bz2
# tar xjf apache-ant-1.9.6-bin.tar.bz2
# mv apache-ant-1.9.6 ant

Remove any existing ant packages

# yum remove -y `rpm -qa | grep '^ant-'`

Create symlink to ant executable

# ln -s /opt/ant/bin/ant /usr/local/bin/ant

If you want ant to be available for root user, then create symlink to ant executable from /usr/local/sbin

# ln -s /opt/ant/bin/ant /usr/local/sbin/ant

Logout out of the system and log back in, command ant should be available for you to use.

1
  • This works fine, but don't copy the exact commands unless you really want v.1.9.6! Go to ant.apache.org/bindownload.cgi to download the version you're looking for.
    – Lambart
    Commented Oct 25, 2019 at 21:12
0

Probably you can download the tarball from here

  1. Download binary file http://archive.apache.org/dist/ant/binaries/
  2. Extract tar -xvf apache-ant-1.x.x.tar.gz
  3. move to its location mv apache-ant-1.x.x /opt/bin
  4. set ant path in /etc/profile or in you .bashrc that is export ANT_HOME=/opt/ant

Once it's done check out the ant version by using ant -version

2
  • Move to /opt/bin or /opt/ant, please? (I do not find opt/bin) Commented Feb 18, 2014 at 11:05
  • 1
    Sorry it was /opt/ant, actually you can keep binary in any location, but export ANT_HOME=your/binary/path in /etc/profile or .bashrc is important. Commented Feb 19, 2014 at 10:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .