Did you ever wonder why there is no Ant support in your Eclipse installation?
If you are working with Eclipse as your standard IDE for PHP Projects you will probably use the PDT Eclipse environment which doesn’t include much of the Java project tools. Ant is one of the very handy ones.
What is Ant?
How does it work?
Tasks you would like to be processed with Ant you put in a build.xml file.
Here is a simple example:
1 2 3 4 5 6 7 8 9 10 11 12
<target name="myTarget" depends="myTarget.check" if="myTarget.run"> <echo>Files foo.txt and bar.txt are present.</echo> </target> <target name="myTarget.check"> <condition property="myTarget.run"> <and> <available file="foo.txt"/> <available file="bar.txt"/> </and> </condition> </target>
To learn how to write your own build files checkout the Ant Manual.
Activating Ant in Eclipse
- In Eclipse go to Help -> Software Updates -> Available Software
- Select Java Development Tools and install it
- Restart Eclipse
Now you should be able to see Ant in your Eclipse Preferences and when you right-click on a build.xml file in your project you can run it via Run As -> Ant Build.