This article is going to cover how to install Apache Ant on Ubuntu 16.04. There are several ways to do that:

  • Using apt-get
  • Using SDKMan
  • Manual installing

In this article, we will cover both of those ways.

Install Apache Ant on Ubuntu 16.04 LTS (Xenial Xerus)

Apache Ant

1. Prerequisite

The current version of Apache Ant is 1.9.x which requires Java 1.5 at minimum. Therefore, you should make sure you have suitable Java installed on your environment.

2. Install Apache Ant on Ubuntu 16.04 using apt-get

To install Apache Ant using apt-get, simply execute the following commands:

You can verify by issuing the command:

3. Install Apache Ant on Ubuntu 16.04 using SDKMan

SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Apache Ant on Ubuntu 16.04.

Make sure you install SDKMan first by following installation guide. After that, you can install Apache Ant on Ubuntu 16.04 by executing the following command:

When finishes, you can verify whether Ant is installed successfully or not by checking its version:

4. Install Apache Ant on Ubuntu 16.04 manually

4.1. Download Ant

You can download Ant distribution from the Apache Ant website. Currently, the latest release of Ant is version 1.9.7.

In the following command, I will download the binary only version of Ant:

4.2. Unpack Ant

The above command will unpack the Ant distribution to /usr/local/apache-ant-1.9.7

Next, we will create a symbolic link to the Ant distribution:

4.3. Create ANT_HOME Environment Variables

Create a ant.sh file at /etc/profile.d folder (you can use vi with below command)

Enter the follow content to the file:

Save the file.

We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:

4.4. Verification

We can verify whether Maven is installed successfully or not by type command:

The output is similar to:

5. Summary

We have learned about how to install Apache Ant on Ubuntu 16.04 by different ways. Installing Ant using apt-get is the simplest way but we may not install our desired version. Installing with SDKMan requires further step to install SDKMan first; however, it’s flexible to switch between different versions of Apache Ant. The last way, manual install will take more effort; but we can take over everything.

Below are other articles related to setup or install build tools on Ubuntu 16.04. You can refer to them if needed.

Install Gradle on Ubuntu 16.04 LTS (Xenial Xerus)

Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)

 

0 0 vote
Article Rating