I needed to installing Jenkins from scratch and setting up a job and of course reading the documentation beforehand never even crossed my mind.  So this is how it went.

Installing Jenkins was a 2 second job.  Double click on the setup file and click Next once or twice (I can’t remember) and you can head to http://localhost:8080 and check out your brand new Jenkins Dashboard.  +1 for easy set up.

I then proceeded to set up a job to get my source code from SVN and build it using a Ant job.  This was also pretty straight forward but when I ran the build I got an error saying:

$ cmd.exe /C '"ant.bat && exit %%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Ant' marked build as failure

Shock and confusion were my initial reactions since I had Ant in my classpath on my machine.  It took me a little while to realize that Jenkins was not using the environment variables on the machine which mean the cheeky bugger was using it’s own environment variables.

Luckily this was found in the obvious place: in Manage Jenkins (on the menu on the left side of the page) -> Configure System.  In here I added my JDK and Ant path and saved the configuration.  You will need to give the JDK and Ant configuration a name and the installation folder if you chose not to use the automatic installation option.  (Don’t forget to click the Save button at the bottom of the page)

After doing this I also had to go back to the configuration for my job and change the Ant task and change the “Ant version” value to the Ant configuration configuration otherwise Jenkins will use the default one and you’ll continue getting the error.

And then the build worked.

(I love happy endings.)


About lsim001

Tester, software tinkerer, student, teacher, joker.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s