How can I build an Eclipse plugin outside of Eclipse?
I have a series of Eclipse projects containing a number of plugins and features that are checked into CVS. I now need to run an automated build of these plugins. Ideally I'd like to do it without having to hardcode large numbers of Eclipse library locations by hand, which has been the problem with the automatically generated Ant files that Eclipse provides. The build also needs to run headlessly.
Does anyone have experience of this sort of set-up with Eclipse, and recommendations for how to achieve it?
There are a few options for you to look at, depending on which build scripting language you're using:
- For Maven2, the way forward seems to be Spring Dynamic Modules. Other options are Pax Construct, m2eclipse, Maven BND
- For Ant/Gant, Eclipse PDE Build, Ant4Eclipse
- For command line or both the above, Buckminster.
At my current clients we use Buckminster, which wraps PDE-Build, and call it from Ant/CruiseControl. We've got code coming in from multiple repositories all being built into a single RCP product.
The standard way to make an Eclipse Build is to use the PDE Build Plugin.
The PDU plugin is normally included with the Eclipse IDE and contains a series of templates. The templates help you set up a system that will:
- fetch: Checkout all plugins and features using a map file, that contains the locations of the plugins
- generate: Creates a build process for every plugin checked out
- process: Compiles the plugins
- assamble: Jars and packs the plugins
- postBuild: Allows to set up automatic tests and deployment
Theoretically all you need to do is to modify a customTargets.xml file , write a map file that contains a reference to every plugin that you need to check out and modify a build.properties file to indicate such properties as the cvs server location.
I had a similar problem to the one you have. The build mechanism is divided into several steps. You can customize the preFetch target of the customTargets.xml file so some "bulk" libraries are imported from specific trees in the repository and add them to the build directory, so you don't have to specify every single plugin in the map.
You can use Tycho to build your eclipse plugins with Maven. This is how the M2eclipse plugin is built. Find out more at http://m2eclipse.sonatype.org
You could write some sort of a script that finds those libraries for you and puts them into a format understandable by Ant.
For example, it could build a eclipse.lirbaries.properties file, then you could read in that file using:
<property file="eclipse.libraries.properties" />
You could also use the FileSet attribute:
Or even a combination of both.
1) Call Ant Script 2) Ant Script calls bash (or whatever scripting language) script which builds eclipse.libraries.properties 3) Ant loads eclipse.libraries.properties 4) Ant goes on with the build