Saturday, July 16, 2011

How to Create A Software Site from Plug-in Bundles for Eclipse Tycho Maven

As of Eclipse Tycho Maven plugin 0.12.0, it can only use "InstallationUnit" type (aka Software Site sources) from a target platform definition file. So you cannot use Features, Installation, or Directory in your target definition file.

If all the plug-ins your Eclipse Platform application requires are already in a Software Site/Update Site, you're lucky. But if not, don't despair. Gather all the plug-ins in a directory and...
(note: you may need to OSGify some files beforehand using Bnd or Eclipse PDE)

The lighting way:
If it already contains feature(s) that list the available plug-ins, just create a .target definition file and in Eclipse right click the .target and export it. Done!
If not, continue below...

The quick way:

  1. Create a Feature project, initial plug-in list is empty.
  2. Create a .target platform definition file in PDE, inside the Feature Project. Add the bundles. Activate it.
  3. Open the feature.xml, Plug-ins tab. Select all plug-ins (use "*.*" filter)
  4. Right click the Feature project, Export... as a deployable feature :-) There, you get your Software Site neatly prepared and ready for some serious Tycho action! :D

The hard way:

To learn more about Eclipse platform programming, I highly recommend Eclipse Rich Client Platform (2nd Edition).

Configuring Eclipse Tycho Maven Plugin to use Target Definition File and Publishing Target Platform Bundles to Update Site

I answered an Eclipse Tycho Maven Plugin question on StackOverfow and I think I should repeat it here (for my own purpose, hehe.. I am forgetful :-)

I should expand this to have better coverage of Tycho workflow but usually I'll get lazy so here it is pretty much verbatim.

Create a Target Definition file (.target) and put it inside a Maven project, see here for example target:

You need to attach the .target file to the artifact, using the build helper:


(from )

Then, in the parent POM or the plug-in projects that use that target definition file, you need to configure the "target" of target-platform-configuration Maven plugin, for example:


(taken from )

Then your project(s) should build very nicely using Tycho. :-) If your .target references remote p2 repositories and not already in the p2 bundle pool, the necessary artifacts will be downloaded automatically.

Good luck!

Known Issue:

[WARNING] Target location type: Profile is not supported 

As of Tycho 0.12.0, It means the "Eclipse Installation" target source type cannot be used with Tycho (yet?), along with "Directory" and "Features".

Solution: Use the "Update Site" target source.

If you don't have yet an update site, here's to generate an update site from an Eclipse installation (or from any folder containing bundles, for that matter):

/opt/eclipse_rcp/eclipse -consolelog -nosplash -verbose \
  -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
  -metadataRepository file:/home/ceefour/p2/bonita/ \
  -artifactRepository file:/home/ceefour/p2/bonita/ \
  -source /home/ceefour/BOS-5.5.1/studio/ \


  • change /opt/eclipse_rcp to your own Eclipse SDK installation
  • metadataRepository and artifactRepository is the folder where the new update site will be created
  • source is --you guessed it-- the folder/installation containing the original bundles

To learn more about Eclipse platform programming, I highly recommend Eclipse Rich Client Platform (2nd Edition)