Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to generate ant build.xml file automatically from Eclipse?

From Eclipse, I found I can easily export an Ant build file for my project. It provides references to 3rd party libraries and some base targets. I'm using it from my global build file. The only thing that bothers me about this, is that if something is modified in the project structure (like adding a new 3rd party library), we have to think (yes that can be hard sometimes!) about regenerating that build.xml file. I'm wondering if anyone here knows a way to have it updated automatically. By "automatically" I mean that it would not be necessary to explicitly ask Eclipse to regenerate it every time it's needed. I don't know what could be the trigger though...

Any thoughts or knowledge on this?

Thanks!

MJ

like image 799
Joanis Avatar asked Nov 15 '10 15:11

Joanis


People also ask

How do I build an Ant build xml?

Create Ant build file In the Project tool window, select the directory, where the build file should be created. Right-click the directory and from the context menu, select New | File ( Alt+Insert ). In the New File dialog, specify the name of the new file with the xml extension, for example, build. xml.

Does Eclipse use Ant to build?

xml, created from a plugin. 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.


2 Answers

Right-click on an Eclipse project then "Export" then "General" then "Ant build files". I don't think it is possible to customise the output format though.

like image 105
Guillaume Avatar answered Sep 21 '22 00:09

Guillaume


I have been trying to do the same myself. What I found was that the "Export Ant Buildfile" gets kicked off in the org.eclipse.ant.internal.ui.datatransfer.AntBuildfileExportPage.java file. This resides in the org.eclipse.ant.ui plugin.

To view the source, use the Plug-in Development perspective and open the Plug-ins view. Then right-click on the org.eclipse.ant.ui plugin and select import as > source project.

My plan is to create a Java program to programmatically kick off the ant buildfile generation and call this in an Ant file every time I build by adding the ant file to the builders of my projects (Right-click preferences on a projet, under the builders tab).

like image 31
Tristan Ratchford Avatar answered Sep 21 '22 00:09

Tristan Ratchford