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.
In Tycho 2.7, two important things were implemented to finally make this long-outstanding issue vanish:
- 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.
- 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.
Now since you are eager to try it out immediately, we’d like to give you a short introduction on how to use it.
In order for this to work, you need to configure the following parts:
- 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.
- Add the pom-first project as part of your reactor, e.g. with a <module> reference.
- 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
- First of all, make sure you have installed the latest m2eclipse release.
- Make sure you are using the latest version of the BND/Felix plugin.
- If you have already imported your pom-first project beforehand, remove it from your workspace.
- 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.
- 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.
- Now go to File > Import > Existing Maven Project and choose your project
- 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).
- 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: