Extension development using eclipse and ant
From Joomla! Documentation
Revision as of 06:16, 21 September 2010 by Batch1211
This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.
There are quite many development environment scenario exist for Joomla extension development, each having their own pros and cons. Here we will setup Eclipse PDT with SVN and ANT plugins to setup our development environment for the purpose in question.
The development environment using Eclipse PDT with SVN and ANT will help you manage your changes in the code and build files for your Joomla Extension without any hassle or monkey work.
If you dont have Eclipse PDT, download it from Official Eclipse PDT website and install it. There is a very good newbie webinar to learn Eclipse use for PHP related web-development. Once you have installed Eclipse and got the comfort level, then download and install Subversive plugin for your SVN needs. Java Development Tool plugin is required for ANT, if you dont have it already, follow instructions from Installing ANT.
As we are focused over Joomla Extension development, we'll not need the Joomla itself to be placed under SVN. Typically, we will setup our extension codebase parallel to Joomla website's root directory.
For example, if your joomla web-application is installed in c:\apache2triad\htdocs\joomla then our extension code base will be c:\apache2triad\htdocs\myjoomextcodebase.
Checkout your project from SVN repository.
SVN Comit/Update Shortcuts
Its good to setup keyboard shortcuts for frequently used SVN COMIT and SVN UPDATE commands. Lazy programmers like me really need to be used-to with these shortcuts, so that svn repo remain updated with latest changes.
Setting up ANT for the project
Place your build.xml file at the root of your extension directory, for example c:\apache2triad\htdocs\myjoomextcodebase\build.xml. Evan Fillman has already a build.xml file for you, copy same file as your build.xml. Place configuration code in a text file and name it anything, like antconf.txt. Dont forget to change value of cfg.localhostRoot to your Joomla installation directory.
Now click the "Show view as the fast view" icon at the bottom-left of your Eclipse PDT. Select Other, in the popup window, expand ANT and then select child ANT, press OK. The empty ANT view will be opened up for you, press "Add Buildfiles" icon, select your build.xml file from the popup and then press OK.
Assuming you have your extension code in place, select the update_localhost from your ANT view and press "Run the Selected Target" icon. You will see that due to build.xml all of your extension files are copied to proper Joomla directories.