Apache Ant Integration with Jenkins
Apache Ant Integration with Jenkins
suranjan horrow no responses

Apache Ant is a java based build tool. ANT stands for Another Neat Tool. Main purpose of Ant is to build java based applications. we can run many built-in tasks like compile,assemble and test. We define the tasks in a build.xml file. Ant reads the xml file and executes the task accordingly. We can also execute shell commands through Ant.

In this tutorial, I will show you how to integrate ant with Jenkins.

I have already setup Jenkins in the server. Now, it is time to install Ant. You can install ant manually and integrate it with Jenkins or you can download and install Jenkins through Jenkins. I am downloading Ant manually and integrating it with Jenkins later.

Download and Setup Ant

my Ant directory is /opt/ant and Ant executable is located at /opt/ant/bin. I need to add some lines in .bashrc file.

Open your .bashrc file and add the following lines.

Now, logout and again login to your root shell to use the exported variables.

Now, Ant is setup in the server. We need to integrate with Jenkins.

Setup Ant in Jenkins

Login to your admin panel in Jenkins. Go to Manage Jenkins -> Global Tool Configuration

In Global Tool Configuration select Add Ant. I have already installed Ant. So I just need to provide Name and ANT_HOME. My  ANT_HOME is /opt/ant.

If you have not Installed Ant, then you can install Ant here. Just select install automatically and choose the appropriate Add Installer option whether you want to extract from zip or install from Apache.


Now, Ant is integrated with Jenkins. You can use Ant in the build process. While configuring a job, in the build option select invoke Ant and choose the Ant version. In my case, I have given the name ant so there are two options available default and ant. Select advance option and you can configure extra parameters. I have chosen the build file build.xml. So when ever Ant is executed it will read from build.xml file.


You can put your build.xml file along with git repository. So whenever you want to test some code you can read from the build.xml file and define different build.xml file for different repository. This is all about setting up Ant with Jenkins. If you have any doubts regarding configuration, you can ask me in the comment.


Leave A Response

Your email address will not be published. Required fields are marked *

Please verify that you are not a robot.