Mixed Reactor Builds with Tycho

The Use Case

While Tycho aims to build PDE assets with Maven and do this job well, since Tycho’s first days, there has been a restriction when using so-called “Mixed Reactor Builds” – that means some parts are built without a Tycho extension and called pom-first projects (e.g. with a felix-bundle-plugin or a bnd-bundle-plugin and jar packaging) – and some are built with Tycho and called manifest-first projects (e.g. eclipse-plugin packaging).

The reason for this was that Tycho resolves project dependencies at a very early stage – actually in the bootstrap phase – before the regular Maven build starts. That leads to the problem that no information or files produced in the build can be used and thus fail a build if one references a package or bundle that is not known a priori.

There have always been some workarounds for this, but they produce rather fragile and hard-to-understand build setups. Another issue was that, in PDE itself, the support for non-PDE projects was rather unrefined and required some kind of expertise to get it working.

The Solution

In Tycho 2.7, two important things were implemented to finally make this long-outstanding issue vanish:

  1. The actual resolving of the compile-class path was moved out of the bootstrap phase and is now part of the validate-class path build step. This also allows parallel resolving of independent projects.
  2.  It is now possible to have an incomplete resolution of project dependencies so Tycho will not fail at that stage, but maybe later on if you do not provide the necessary items of course.

In m2eclipse 1.20, enhanced first-class support for the felix-bundle plugin and the bnd-bundle plugin have been added together with some PDE enhancements in order to better handle pom-first projects.

Starter Guide

Now since you are eager to try it out immediately, we’d like to give you a short introduction on how to use it.

Tycho Setup

In order for this to work, you need to configure the following parts:

  1. You need to enable the <pomDependencies>consider</pomDependencies> in your target configuration. This will enable the support for the partial resolving of manifest-first projects and will consider dependencies from the Maven model.
  2. Add the pom-first project as part of your reactor, e.g. with a <module> reference.
  3.  Add a dependency to the pom-first project in your pom.xml (for pom-less projects, add it to the master-pom) of the manifest-first project.

Now you are done. For a complete example, take a look at the following integration test from Tycho: https://github.com/eclipse/tycho/tree/master/tycho-its/projects/mixed.reactor

Eclipse IDE

  1. First of all, make sure you have installed the latest m2eclipse release.
  2. Make sure you are using the latest version of the BND/Felix plugin.
  3. If you have already imported your pom-first project beforehand, remove it from your workspace.
  4. Make sure to delete all .project, .classpath, .settings before you proceed (of course, if your project is not versioned, make backup copies beforehand) so you start with a plain pom.xml in the root directory.
  5. You might want to remove any PDE workarounds like placing the generated manifest in the root of the project and the like – that’s no longer necessary and you can simply use the defaults.
  6. Now go to File > Import > Existing Maven Project and choose your project
  7. After the import, check the pom.xml to see if there are any warnings (e.g. because the felix plugin incremental builds need to be explicitly enabled to make this work).

Now that you are done, every change in your pom-first bundle should be immediately shown in your workspace. If not, please don’t hesitate to let us know and open a bug report (see below).

Current Limitations

  •  If you do not execute at least the package phase, your build will fail with missing dependencies for projects depending on pom-first projects (see Issue #479)
  • PDE sometimes requires a restart to fully identify your pom-first bundle if the configuration changes (see Bug 578990)
  • For pom-less builds, one needs to configure the dependencies in the master pom.xml because there is no project pom.
  • Sometimes it is necessary to trigger the generation of the manifest manually (see https://issues.apache.org/jira/browse/FELIX-6493 ) e.g. by performing a build from the Run As > Maven install menu of the pom.xml file.

There might be more to discover. Let us know if you think there would be more things to add. If you feel a missing feature (or bug you have discovered) is crucial to your mission, please do the following:

  1. Let us know by opening a bug report (either at Tycho, m2eclipse or PDE)
  2. Provide a patch that fixes the problem. It’s all open source and everyone is encouraged to participate!
  3. You can always contact us and offer the funding for a feature or bug-fix.
background
ABOUT LÄUBISOFT

Läubisoft GmbH is an independent, owner-operated company for the development of individual IT and software solutions. The company was founded in 2010 from Christoph Läubrich who holds a university diploma in computer science.

Member of OSGi Alliance

CONTACT

Läubisoft GmbH
Barger Weg 12
23611 Bad Schwartau

0451 – 88191541

Back to top of page