Sonatype's Tycho, m2eclipse and Maven: Eclipse Plugin and OSGi development simplified


August 21, 2008 By Jason van Zyl

On the m2eclipse mailing list Alexandre Sauvé asked about the future of Eclipse RCP-based application development with Maven and so Igor Fedorenko, who leads our development on Tycho, responded with a short summary of what we’re planning and what’s been accomplished so far with Tycho.

Here’s what Igor had to say:

First of all, I have to apologize for keeping Tycho development plans and progress to myself. I would like to thank you for bringing this up and will try to both explain our grand vision and what we already have or will have implemented in the near future.

The big picture. Ultimately, we want tycho to be one-stop solution for doing Eclipse and OSGi development with Maven 2 (actually, 3, more on this later). We believe there are two distinct development workflows, when developer explicitly creates and maintains OSGi manifest and other Eclipse/OSGi metadata (we call it “manifest-first”) and when OSGi metadata is generated by the build based on information available from pom.xml (“pom-first”, naturally). We plan to support both development workflows.

In manifest-first mode, tycho will use Eclipse/OSGi metadata and OSGi rules to calculate project dependencies dynamically, at build time. It will support all attributes supported by Eclipse OSGi resolver (Require-Bundle, Import-Package, Eclipse-GenericRequire, etc). It will use proper classpath access rules during compilation. It will support all projects supported by PDE and will use PDE/JDT project metadata where applicable. One important design goal is to make sure there is no duplication of metadata between pom.xml files and Eclipse/OSGi config files. In fact, tycho will support “pom-less” projects, where all required build metadata is derived from Eclipse/OSGi config files.

In pom-first mode current plan is to provide similar set of features as in felix/bnd plugin, although I do not know if we’ll be able to share any of the code. Additionally, Tycho will support Eclipse-friendlier Require-Bundle and will provide better support for developing multiple related OSGi bundles (I have not checked recently, so felix/bnd may already support these).

In both modes tycho will support remote repositories both as source and sink for artifacts. We plan to support maven repositories, p2 and update sites, although level of support will likely vary. There will also be integration between m2e, tycho and pde to make the three work nicely together.

So these are the plans… Disclaimer: plans do change! ;-)

Now to what tycho is already able to do. Our first goal was to enable m2e continues build, so we started with manifest-first mode and I believe covered most of manifest-first features described above. Tycho already uses Eclipse/OSGi metadata to resolve project dependencies by OSGi rules and injects these dependencies into maven project model dynamically, at build time. It supports bundle, fragment, feature and update site projects (shame on me, but no RCP application yet). It knows how to run junit test plugins using OSGi runtime. Two big features that are still missing, are support for pom-less projects and work with artifact repositories, although there is prototype of target platform materialization from p2 repository already. There is also some rudimentary implementation of pom-first mode, but its usability outside of m2e build context is probably limited. Many smaller features are still missing and I am certain there are quite a few bugs too, but I think overall tycho code is in reasonably good shape already.

Few words about relationship between maven and tycho. Tycho is not morphing into maven, but it provides maven extensions and plugins that enable maven to work with Eclipse/OSGi projects. Some of tycho functionality, especially OSGi dependency injection, relies on maven features only available in maven 3.0 which was very recently renamed from 2.1. Since there is no maven 3.0 release yet, current tycho distribution includes complete copy of maven 3.0-SNAPSHOT.

As for contributing to the project… well, this would be really awesome . I think the best way to start is to try tycho and see what is missing to support your projects and development workflow. Then we can work together to implement missing features, fix bugs, etc. I have simple demo that shows how to use tycho to build set of simple projects and some user-level documentation. I will try to make this available later today. I will also provide tycho dev env setup steps, so you can start looking at the code if you want to. And tycho distribution is already available from the Sonatype Maven repository (looks for the latest .zip file)

I hope it answers your questions, but feel free to ask more, especially if something is not clear or does not make sense. You can subscribe to the m2e mailing list if you want to learn more.