Monday, December 10, 2007

Eclipse : Ant Projects

Running Ant From Eclipse

We can run Ant targets from build.xml files from within Eclipse, but there's a little setup you have to do.

Create a new Simple Project (not a Java Project), I call mine "ANT_ProjectName".

  1. Right click on the Ant project and select New > File
  2. Click the Advanced button
  3. Select the option Link to file in the filesystem
  4. Browse for the build.xml file, if you expanaded to c:\alfresco you need to browse to c:\alfresco\common, select build.xml and press the Open button
  5. Enter build.xml in the File name field.
  6. Click Finish

You should now see a link to build.xml in your Ant project. Double-click the file to see the contents. Eclipse also has several options to allow you to run targets in the file.

One way is to use the 'Outline' window as it shows you all the targets in the project. Find the target you want to run and right click. Choose Run As > Ant build.

If you really want to you can also debug the Ant script by placing a breakpoint in build.xml and choosing Debug As > Ant Build.

No comments :

Powered by Blogger.