How to install Apache Ant on Linux Debian 9?

How to install Apache Ant on Linux Debian 9?

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks. – by ant.apache.org

PREREQUISITES

  1. JDK

DOWNLOAD

We can download the Apache Ant from the official site of Apache Ant. The download link has been given below.

https://ant.apache.org/bindownload.cgi

CHANGE DIRECTORY

Execute the following command to change the directory into “/usr/local” in your Linux Debian machine.

cd /usr/local  

WGET

By using WGET command, we can download the latest Apache Ant from the official site. The WGET command is given below.

sudo wget https://www-eu.apache.org/dist//ant/binaries/apache-ant-1.9.14-bin.tar.gz

EXTRACT THE FILE

By using below commands to extract the downloaded Apache Ant file.

sudo tar xzf apache-ant-1.9.14-bin.tar.gz 
sudo ln -s  apache-ant-1.9.14 apache-ant 

SET ENVIRONMENT VARIABLE

Use the below command to set the environment variable by using vi editor.

sudo vi /etc/profile.d/apache-ant.sh

Add the following lines to set the environment path for Apache Ant.

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

LOAD THE ENVIRONMENT PATH

To load the environment path, execute the below source command.

source /etc/profile.d/apache-ant.sh 

CHECK ant VERSION

Execute the following command to check the Apache Ant version.

ant -version
Apache Ant version

Apache Ant 1.9.14 has been installed successfully on Linux Debian 9.

Advertisements

How to install Apache Ant on Windows 10?

How to install Apache Ant on Windows 10?

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks. – by ant.apache.org

PREREQUISITES

  1. JDK

download

We can download the Apache Ant from the official site of Apache Ant. The download link has been given below.

https://ant.apache.org/bindownload.cgi

I have downloaded the Apache ant 1.9.14 version zip file and saved into my machine.

Apache Ant Zip file

Extract the downloaded zip file now. The extraction may take time depending the file size.

Apache Ant extracted file

SET ENVIRONMENT VARIABLE

Follow the below steps to set the environment variable for Apache Ant. The steps are given below .

#1. Go to the My Computer –> Properties

This image has an empty alt attribute; its file name is image-4.png
My Computer –> Properties

#2. Open the Environment Variable window by clicking the Advanced System Settings –> System Properties –> Environment Variables…

This image has an empty alt attribute; its file name is image-53.png
Environment variables

#3. Select the System variable “Path” and click the “Edit” button.

This image has an empty alt attribute; its file name is image-54.png
System variables

#4. Click the “New” button on the edit environment variable window and the add the Apache Ant extracted file location up to the bin folder and then click “OK” button. In my system, I have downloaded and extracted the Apache Ant zip file on the following location up to bin folder.

C:\softwares\apache-ant-1.9.14\bin
Apache Ant Environment Path

ANT_HOME

To set the ANT_HOME environment variable follow the below steps.

#1. Click “New” button on the System variable window and provide the variable name is “ANT_HOME” and variable value is Apache Ant zip file extracted path. In my system, I have download and extracted the zip file on the following location.

C:\softwares\apache-ant-1.9.14
ANT_HOME path

#2. Click “OK” button on all opened windows and open the new command prompt to execute the following command to check the Apache Ant version. The Apache Ant version should be 1.9.14.

ant -version
Apache ant version

Apache Ant installation has been done on Windows 10.