A while back - too long ago - I started a series of blog posts about getting up and running with Jenkins for continuous integration. I left off with talking about Apache ANT (which stands for Another Neat Tool). ANT is basically XML which allows you to tell Jenkins the steps you'd like to take to "build" your site continuously. Installing ANT was not as straightforward as I thought, so I'd like to share a bit of my experience so that hopefully it will be smooth sailing for you.
You are going to be installing two pieces of software - a Java Development Kit and then Ant. Where you install these items is important. Please be aware of this and it will prevent you from wanting to impale yourself. If you're on Windows 7, you may have noticed that there are two places where your program files might be saved on your hard drive:
- c:\Program Files
- c:\Program Files (x86)
Wikipedia says, "64-bit versions of Windows have two folders for application files; 'Program Files' folder serves as the default installation target for native (in this case 64-bit) programs, while the 'Program Files (x86)' folder is the default installation target for non-native (in this case x86-32) programs."
Here's how you can (and should) check what your JAVA_HOME path is:
Open the command line (click start, type "cmd" and then enter). When the command line opens type "echo %JAVA_HOME%" and then enter. Note the path that is returned. This is your Java home path. I will presume that it is c:\Program Files (x86)\Java like this:
If c:\Program Files (x86)\Java isn't your Java home path, leave a comment at the bottom of this post and I'll talk you through what to do next.
Step 1. Install the Java Development Kit
Go to this address: http://bit.ly/16HcfHy, accept the license agreement and download the appropriate Java Development Kit. Important: If you are on a 64-bit version of Windows click the jdk-7u21-windows-x64.exe link. If you're on a 32-bit version of Windows click the jdk-7u21-windows-i586.exe link. If you're on a Mac or other _nix machine Im guessing you know what to do ;)
After the file downloads, go ahead and start the install.
Note the "Install to:" path. You're going to change this to c:\Program Files (x86)\ so click the "Change..." button
Browse to the correct Java home path and click OK
Now that you have the correct path click Next and the install will begin
When the install is complete you'll see the following screen:
Click Close because you're done! Now on to the ANT part.
Step 2. Install ANT
Go to this link: http://bit.ly/10RiFfg and click the "Download the latest verson" link from under the "get it" title.
After it downloads, double-click to begin the installation.
Click Next again
Click the "..." to choose the directory of your Java home path - c:\Program Files (x86)\Java
Choose the default location for installing ANT which should be c:\Program Files (x86)\WinAnt and then click Next
The install will begin
You may get a pop-up notification about having to log out and back in. Just click OK.
If you click the "Show Details" button you can see everything that's happened (or happening) during the install, but you're not required to do so.
When the installation is complete you'll get a pop-up asking if you'd like to donate to WinAnt. You don't have to but it's good karma ;)
Click Close and you're done. Now you need to verify that everything went as planned. If you have a command line window open, close it and re-open it. This will assure that nothing is cached. In the newly-opened command line type "ant -version". You should see the following:
Thats it. Congratulations, ANT is up and running on your machine. Next post will explain more about what it does and the scripts you can write.
I noticed that the vast majority of folks who had issues were trying to install a JRE (Java Runtime Environemt) rather than the JDK (Java Development Kit). Please be careful with this. If you use the links to the installers I provided you shouldn't have a problem. If you do, let me know and I'll try to help you out.
As an important footnote, it wasn't until I was almost done with this post that I noticed Steven Neiland had written a blog post on almost the same exact thing. My approach is slightly different and easier in my opinion because it makes use of installers. Steven's approach has links to the latest version of ANT while WinAnt might not always be updated to the latest version. You can see his blog post here: http://bit.ly/10RgEzC and follow Steven on Twitter @sneiland - he has lots of great information!!