Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want an eclipse java project to run ant build files automatically

Tags:

I have an Eclipse Java project, not a plugin project. And the project has some external dependencies that I handle in two separate ant files. Everything works fine, but I want to force Eclipse to run the ant files everytime it builds my project.

How can I do that?

If this had been a plugin project I would have handled it in a customBuildCallbacks.xml and included it in my build.properties, but doesnt seem to work when its just a java project

like image 808
Fredrik Avatar asked Apr 14 '11 14:04

Fredrik


People also ask

Does Eclipse use Ant to build?

xml file for assembling a deployable version of your plug-in. The Ant UI as provided in Eclipse comes with a first-class Ant build-file editor, including syntax highlighting, Content Assist, templates, and content formatting. This editor is automatically associated with files named build.

How do I run Ant clean in Eclipse?

Right click on the build. xml > Run As > Ant Build... On Targets tab, check clean option.

What is auto build in Eclipse?

By default, you are in auto-build mode and Eclipse takes care of compiling source files automatically. Builds occur automatically in the background every time you change files in the workspace (for example saving an editor). Auto-build is convenient because it means problems view, binaries, etc.


1 Answers

Step 1: Add the build file to your ant view

Click the add button and select the build.xml file from the project. You can also drag the build.xml file onto the ant view (To add the ant view to your perpective, go to Window > Show View > Other…)

Step 2: Run as Ant Build

In your ant view, right click the newly added build file and select Run As > Ant Build… In the dialog window, select the ‘Hide internal targets not selected for execution’ option in the Targets tab. You can rename the builder in the box at the top of the window if you wish (I usually remove the trailing ‘build.xml’. Click Apply and Close.

Step 3: Setup automatic build

Right click on the project, select Properties, then Builders. Click Import. Before closing the screen, highlight the imported build and select edit. Go to the Targets tab select clean for ‘After a clean’ and deploy.local for ‘Auto build’. Apply the changes and close.

Step 4: Enable Auto Build

Go to Project > Build Automatically

source: http://www.simonwhatley.co.uk/using-ant-with-eclipse

like image 184
JuanZe Avatar answered Sep 18 '22 14:09

JuanZe