Installing ANT on Windows and or Mac OS X
Posted:
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:\ant
set JAVA_HOME=c:\jdk-1.5.0.05
set 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/ant
export PATH=${PATH}:${ANT_HOME}/bin
Now 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 failed
To 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 following
ant -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.xml
You should now see
Buildfile: {PATH_TO_YOU_BUILD_FILE}build.xml
runEcho:
[echo] Is anybody out there
BUILD SUCCESSFUL
Total time: 0 seconds
That'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!