RCBian
RCBian

Reputation: 1080

How to set ANT_HOME in Jenkins in Ubuntu

I am new to Ubuntu.I have installed ant using apt-get install ant then I tried which ant which showed the path /usr/bin/ant I included the same path in Jenkins ANT_HOME but it shows /usr/bin/ant is not a directory.I tried adding the ANT_HOME in .bashrc file .what should I need to do to set the ANT_HOME in Jenkins.Please help

Upvotes: 3

Views: 7410

Answers (3)

David W.
David W.

Reputation: 107030

Jenkins can use its own versions of Ant, and this is really the preferred way. You can have multiple versions of Ant in Jenkins, and each job can use whatever version you desire.

Go to the Configuration Section ($JENKINS_SERVER/jenkins/configure). Look for the Ant section, and click on the Ant Installation button. To add an Ant installation, click on Add Ant, then add in a name which should include the Ant version. Click on the Install Automatically button, and under the Install from Apache, select the version you want to install.

Once this is done, you will get a choice of Ant installations when you select that you want to do an Ant Build when you configure a job.

Using the default Ant version can be tricky if it is updated, and your job can't use the newer version. Or, if someone adds something to the default Ant version that breaks your builds.

Upvotes: 5

Slav
Slav

Reputation: 27485

As others have mentioned, you should install ANT through jenkins itself, which allows multiple versions without polluting the actual jenkins machine environment. But if you must...

I tried which ant which showed the path /usr/bin/ant I included the same path in Jenkins ANT_HOME but it shows /usr/bin/ant is not a directory.

which ant shows the path and executable. Your error is 100% correct and expected: /usr/bin/ant is not a directory. /usr/bin/ is the path to the directory and ant is the executable.

Upvotes: 0

TEDDY
TEDDY

Reputation: 821

try export ANT_HOME=/usr/bin/ant export JAVA_HOME=/usr/local/jdk1.8.025 export PATH=$PATH:${JAVA_HOME}/bin:${ANT_HOME}/bin

Upvotes: -3

Related Questions