We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How to Install Latest Apache Ant on Ubuntu, Debian and Linux Mint

Learn how to – How to Install Latest Apache Ant on Ubuntu, Debian and Linux Mint.

Apache Ant is a Java library and command-line tool for automating software build processes. This guide will help you to install the latest release of Apache Ant on Ubuntu, Debian and Linux Mint.

Apache Ant is written in Java by Apache Software Foundation and released under Apache License 2.0 license. Follow steps below to Install Apache Ant on Ubuntu, Debian and Linux Mint.

First install Java on your system:

How to Install Java 11 on Ubuntu 18.04 /16.04 / Debian 9

For Java 8, install it using commands below

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-set-default

Confirm installed version of Java:

$ java --version
java 11.0.1 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Method 1: Install Latest Apache Ant Manually

This is the most reliable way of getting the latest release of Apache Ant on to your Ubuntu, Debian or Linux Mint system.

Check for the most recent release of Apache Ant before proceeding with the next steps. As of this writing, this is version 1.10.5

Save this version to a variable for later use.

export VER="1.10.5"

Then download the file

sudo apt install -y wget vim
wget https://www-eu.apache.org/dist//ant/binaries/apache-ant-${VER}-bin.tar.gz

Uncompress the downloaded file.

sudo tar -xvf apache-ant-${VER}-bin.tar.gz -C /usr/local

Since the destination folder will have Ant version appended, let’s create a symbolic link for it.

sudo ln -s /usr/local/apache-ant-${VER}/ /usr/local/ant

Finally create ANT_HOME variable and update your PATH.

sudo vim /etc/profile.d/ant.sh

Add:

export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin

Source the file and test

$ source /etc/profile.d/ant.sh
$ echo $ANT_HOME
/usr/local/ant
$ echo $PATH

Check Ant version:

$ ant -version
Apache Ant(TM) version 1.10.5 compiled on July 10 2018

To update Ant:

  • Remove Symbolic Link
  • Download and uncompress new Ant to /usr/local directory
  • Recreate symbolic Link

Example:

# Unlink
$ sudo unlink /usr/local/ant

# Update new symlink
$ sudo ln -s /usr/local/apache-ant-${VER}/ /usr/local/ant

Method 2: Install Apache Ant from Apt repository

Apache Ant package is available on both Debian and Ubuntu upstream repositories. With this method, you won’t get the latest release of Apache Ant.

Install it by running the commands:

sudo apt update
sudo apt -y install ant

Once the package is installed, you can check for version using:

$ ant -version
Apache Ant(TM) version 1.10.3 compiled on July 19 2018

Method 3: Install Apache Ant with SDKMAN

SDKMAN is a tool for managing parallel Versions of multiple Software Development Kits on any Unix based system. It provides a convenient command line interface for installing, switching, removing and listing Candidates.

Like Apt method (2), you will not get the latest release of Ant. To get the most recent release, use Manual Method 1

Step 1: Install SDKMAN

Install SDKMAN on your system using the command below:

$ curl -s get.sdkman.io | bash
Now attempting installation…
Looking for a previous installation of SDKMAN…
Looking for unzip…
Looking for zip…
Looking for curl…
Looking for sed…
Installing SDKMAN scripts…
Create distribution directories…
Getting available candidates…
Prime the config file…
Download script archive…
################################################################## 100.0%
Extract script archive…
Install scripts…
Set version to 5.7.3+337 …
Attempt update of interactive bash profile on regular UNIX…
Added sdkman init snippet to /root/.bashrc
Attempt update of zsh profile…
Updated existing /root/.zshrc
All done!
Please open a new terminal, or run the following in the existing one:
source "/root/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
Enjoy!!!

Step 2: Install Apache Ant on Ubuntu / Debian / Linux Mint

The sdkinstall command is now available for you to install the latest stable Apache Ant on Ubuntu, Debian and Linux Mint.

$ source ~/.sdkman/bin/sdkman-init.sh
$ sdk install ant

That’s all. You should now have Apache Ant installed on your Ubuntu, Debian and Linux Mint system.

Cart

Your Cart is Empty

Back To Shop