Friday, 22 April 2011

Eclipse: Add Your Own Builder


The main objective of this article is to walk you through injecting Ant scripts during project build.
By default we have a 'Java Builder' which runs the internal Eclipse Java compiler. This process ensures that your source code is properly indexed and hence searchable. This makes features like refactoring easy and fast.

Now here are the steps to add your own builders (we'll add an Ant builder here):

First step is to select your project and go to project properties (Refer screenshot).














Once the project properties dialog appears select builders from the left hand side. On the right hand side you will see Java Builder.
By default it is selected. Click on New and select "Ant Builder" as shown in the screenshot below:
























Another dialog to edit configurations will appear on the screen. Enter the builder name as per your choice. Select the appropriate build file and enter arguments if any (Refer screenshot).

























By default resource files are not refreshed when a project builder finishes running. To enable it you need to select "Refresh resources upon completion" in the "Refresh" tab (Refer screenshot).























Now its time to select the appropriate target from the build file which needs to run during the build.























Once you are done with the changes hit OK and the new Ant builder will appear along with the default Java Builder under Builders section.


No comments:

Post a Comment