tags:

views:

230

answers:

1

Hi

I want to invoke the export to xml function of eclipse programatically to create the build.xml files, so that it can be in a continuous integration process.

Is there an easy way to do it, without opening Eclipse?

Thanks, Aakash

+1  A: 

org.eclipse.pde.build contributes an ant task "eclipse.buildScript" which generates the build.xml scripts that are using in export and headless pde builds.

There are quite a few properties that serve as inputs to this task. The simplest way to call it directly from the command line would be something like:

eclipse -application org.eclipse.ant.core.antRunner -f plugins/org.eclipse.pde.build_3.5.0.v20090521-1730/scripts/genericTargets.xml generateScript

You would also need to pass a bunch of -Dproperty=value arguments to set the input properties. It might be simpler to write a wrapper build.xml script that you would run using the antRunner, in that case, the genericTargets.xml script would be located at ${eclipse.pdebuild.scripts}/genericTargets.xml.

There is some documentation on the task here. This is used as part of the larger automated build support provided by pde.build, docs for that start here.

Andrew Niefer
Sorry, due to some unforeseen delay, I was not able to look into this earlier. Now, I am back at the same problem :)It seems that this task only works for plugins and features, which I don't have. I have a normal Java project, with a .project and a .classpath file. How do I generate the ant file for this project?Is there a special type and id, in the type@id input to the task?ThanksAakash
Aakash
This task generates classpaths according to the MANIFEST.MF. It doesn't work for normal java projects. I don't know if there is anything that generates build.xml for regular java projects. There is an <eclipse.incrementalBuild/> (http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/ant_eclipse_tasks.htm) which will run the workspace builder from ant.
Andrew Niefer