Andy Jarrett // Code. Develop. Create.

Installing ANT on Windows and or Mac OS X

I'm gonna try and cover the two OS's here so be kind.First things first, goto http://ant.apache.org/bindownload.cgi and download the appropriate archive (zip) file: apache-ant-[VERSION NUMBER HERE]-bin.zip Then for Windows: Extract the .zip to c:\\ant. From the command line set the following environment variables:set ANT_HOME=c:\\antset JAVA_HOME=c:\\jdk-1.5.0.05set PATH=%PATH%;%ANT_HOME%\\bin For Mac: Unpack the zip file to /usr/local/ant/. Then from the command line set the following environment variables:export ANT_HOME=/usr/local/antexport PATH=${PATH}:${ANT_HOME}/binNow open up the Terminal(Mac)/Command line(Win) and just type "ANT" and hit return. You should see:Buildfile: build.xml does not exist!Build failedTo demonstrate calling a file we're gonna create a quick build.xml. Create a new text file, enter the following bit of XML and save it as build.xml If you are on Windows save this file to the root of c:\\ and from the command line run the followingant -buildfile c:\\build.xml
If you are on Mac then just save this to the desktop and from the Terminal run:ant -buildfile ~/desktop/build.xmlYou should now seeBuildfile: {PATH_TO_YOU_BUILD_FILE}build.xmlrunEcho:[echo] Is anybody out thereBUILD SUCCESSFULTotal time: 0 secondsThat's pretty much it, from here you you are now set to run Ant from the Terminal/Command line so in theory you should be able to schedule tasks etc!

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️