How To Install ant on CentOS 8

ant is Java build tool

Introduction

In this tutorial we learn how to install ant on CentOS 8.

What is ant

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.

We can use yum or dnf to install ant on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install ant.

Install ant on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install ant using dnf by running the following command:

sudo dnf -y install ant

Install ant on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install ant using yum by running the following command:

sudo yum -y install ant

How To Uninstall ant on CentOS 8

To uninstall only the ant package we can use the following command:

sudo dnf remove ant

ant Package Contents on CentOS 8

/etc/ant.conf
/etc/ant.d
/usr/bin/ant
/usr/share/ant/bin
/usr/share/ant/bin/ant
/usr/share/ant/bin/antRun
/usr/share/ant/etc
/usr/share/ant/etc/ant-update.xsl
/usr/share/ant/etc/changelog.xsl
/usr/share/ant/etc/common2master.xsl
/usr/share/ant/etc/coverage-frames.xsl
/usr/share/ant/etc/log.xsl
/usr/share/ant/etc/mmetrics-frames.xsl
/usr/share/ant/etc/printFailingTests.xsl
/usr/share/ant/etc/tagdiff.xsl
/usr/share/doc/ant
/usr/share/doc/ant/KEYS
/usr/share/doc/ant/README
/usr/share/doc/ant/WHATSNEW
/usr/share/licenses/ant
/usr/share/licenses/ant/LICENSE
/usr/share/licenses/ant/NOTICE
/usr/share/man/man1/ant.1.gz

References

Summary

In this tutorial we learn how to install ant on CentOS 8 using yum and dnf.