Monday, January 7, 2013

Tycho build 4: Building features

For the following tycho tutorials I expect you to have set up a global build project. Now we are going to build a feature, which is really easy with tycho.

Tycho Tutorials

For a list of all tycho related tutorials see Tycho Tutorials Overview

Source code for this tutorial is available on github as a single zip archive, as a Team Project Set or you can browse the files online.

Step 1: Convert feature project to maven project

The feature com.codeandme.tycho.plugin.feature already includes our plug-in com.codeandme.tycho.plugin. The only thing to do is convert the feature project to a maven project. Do this using the context menu Configure/Convert to Maven Project. I guess you are familiar with the procedure right now.

 Make sure you set Packaging to eclipse-feature.
Now open the pom file of your releng project (com.codeandme.tycho.releng/pom.xml) and add our feature project as a new module. Don't forget to check Update POM parent section in selected projects.
As before you will see an error marker on your feature project. To get rid of it switch to the Problems View, locate the error and use the quick fix feature to solve it.

Run your build to verify your settings.


  1. Hello,
    Great tutorials, thank you!
    Maybe a stupid question, but why do I need to build a featrue.xml at all? What is the output? Features.xml is a collection of other bundles, do I get all of these jared in the target folder? Cant try it still get an error: Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.16.0:validate-version (default-validate-version) on project com.example.tycho.plugin.feature: OSGi version 1.0.0 in feature.xml does not match Maven version 0.0.1 in pom.xml -> [Help 1]

    1. Features are used to cluster bundles to convenient units. P2 will show features to your users, it will not show bundles which can be selected for install. You might want to keep your code in multiple bundles (eg UI/non UI) but still they serve the same topic (like Java programming). Then features are used to put it all together.

      Regarding your error: seems the version number in your pom is 0.0.1.SNAPSHOT. Change it to 1.0.0.SNAPSHOT as in the screenshot above