How to build a RAP application with Tycho

Recently I played around a little with Tycho because we evaluated it for the use in the RTP project. As a test case, I decided to try to build a RAP application with Tycho. With building I mean compiling and packaging the artifacts into a WAR file in order to deploy them on a Tomcat or another Servlet Container.

I have to say that I’m really impressed with Tycho. Before this experience, Maven was the “bad thing that downloads the internet” to me. Okay, it still downloads the internet but in this case it’s very useful. You can add p2 repositories to resolve dependencies and it automatically downloads the right bundles. You can define the dependencies in your MANIFEST.MF and use the pom.xml to describe what kind of package it is, e.g. a feature or bundle. For building the RAP application, I just had to add the Helios p2 repository to solve all my feature’s dependencies.

Now, you might want to know how to build the application with Tycho yourself. I published the code on github [1]. It’s just the example Mail application and a sample feature that can be built with Tycho. Follow the README instructions to run the build. Here are a few notes you might need if you want to use this configuration as a template for your own build:

  1. Edit the feature.xml from com.eclipsesource.maildemo.tycho.feature, adding your dependencies.
  2. The build uses a static configuration.ini. As a result, you have to edit the configuration manually and add your own bundles. You will find the configuration.ini in the com.eclipsesource.maildemo.tycho.feature feature in the templates/WEB-INF/eclipse/configuration folder.
  3. Create a pom.xml for every bundle you created with the following content:
  4. Change the artifactId from com.eclipsesource.maildemo.tycho to your own Id.  You’ll also need to change the parentId when you use your own Id.
  5. Edit the pom.xml in the parent folder and add your modules. To add modules you just need to add the folder names from the different bundles to the file.
  6. In the pom.xml of the feature, change the naming of the “maildemo” to create a .war file with the name of your choice.
  7. Of course you can use your own groupIds and artifactIds. But, you have to reference the parent pom.xml artifactId in every bundle’s pom.xml

I hope these steps and the example build will help you to create your own Tycho based builds for RAP applications. Maybe you have some experiences or ideas you’d like to share?  Please feel free to post comments.


14 Responses to “How to build a RAP application with Tycho”

  1. Markus says:

    Nice one Holger!
    It worked like charm within eclipse but failed in Hudson for me.
    Since you tagged it hudson i’m curious to read if you had to change anything
    to build it with hudson.
    So far i could’nt get rid of the following exception:

    org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
    [ERROR] Unknown packaging: eclipse-plugin @ line 14, column 14
    [ERROR] Unknown packaging: eclipse-feature @ line 26, column 13

    Any clues?

  2. Sounds like you use Maven2. Anyway, I suggest that you use a freestyle hudson job and add the build step “invoke top level maven pom”. Make sure to use Maven3.

  3. Markus says:

    Hi Holger,
    I configured hudson to use Maven 3.0.2 and created a ‘Maven 2 project’ because it says it’s suitable for Maven 3 also.
    However, it wasnt working.

    The freestyle job immediately worked.


  4. Andreas says:

    As written in the README I tried a mvn clean install on the Tycho-projekt within eclipse. But I ended up with some resolution errors:

    [ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle com.eclipsesource.maildemo.tycho cannot be resolved
    [ERROR] Resolution errors:
    [ERROR] Bundle com.eclipsesource.maildemo.tycho – Missing Constraint: Import-Package: javax.servlet; version=”2.4.0″
    [ERROR] Bundle com.eclipsesource.maildemo.tycho – Missing Constraint: Import-Package: javax.servlet.http; version=”2.4.0″

    Any clues to that one? Am I missing something obvious?

  5. Oliver says:

    Tried to build the mail example with tycho as RCP and RAP application. Therefore I placed the branding extension to a fragment. The build of the RCP with a launcher exe was successful. Also a war was created, but without the fragment (which is needed only for the RAP build) in the war. Any idea to get the fragment in the war file?

  6. Markus says:


    Add the fragment to the plugins in your feature.xml.

  7. Oliver says:

    Found my fault…copied the plugin.xml from the host plugin to the fragment and edited. But did not renamed it to fragment.xml :)
    Now it works, thanks.

  8. Alexander says:

    Unfortunately, it builds but it is not well deployed under JBOSS 4.2.3.
    It says:

    !ENTRY org.eclipse.osgi 2 0 2011-06-15 01:49:29.876
    !MESSAGE While loading class “org.eclipse.ui.PlatformUI”, thread “Thread[Framework Event Dispatcher,5,jboss]” timed out waiting (5000ms) for thread “Thread[Start Level Event Dispatcher,5,jboss]” to finish starting bundle “org.eclipse.rap.ui.workbench_1.3.2.20110216-1023 [24]“. To avoid deadlock, thread “Thread[Framework Event Dispatcher,5,jboss]” is proceeding but “org.eclipse.ui.PlatformUI” may not be fully initialized.
    !STACK 0
    org.osgi.framework.BundleException: State change in progress for bundle “initial@reference:file:plugins/org.eclipse.rap.ui.workbench_1.3.2.20110216-1023.jar/” by thread “Start Level Event Dispatcher”.
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(
    at org.eclipse.osgi.framework.util.SecureAction.start(
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClas

    I have 64-bit JVM

  9. Ilja says:


    Has anybody tried to deploy a war package? Didn’t do any changes, just run mave install on a tycho’s bundle and deploy the maildemo.war. Didn not work, 404. Any comments?


  10. Samy says:

    Hi Holger,

    thank you for you blog – it was a very good starting point!

    I adapted your simple example to my project – with of course more plugins and dependencies and had the following stumbling points and problems that I would like to share to other Tycho newbies:

    * when copying the pom.xml into your project folders you need to adapt not only the name of the plugin but also update the version number to exactly the same as you have in the respective manifest file.
    * when preparing the my feature project I stumbled twice – but these where actually easy and fast to fix :-) :
    ** forgot to copy the template folder into my project folder
    ** forgot to adapt the config.ini to list all my plugins
    * when I run the mvn command, I get a lot of warnings telling me that bundles could not be read. Looks like these warnings can safely be ignored.
    * We work in our project with a directory based target platform definition. I did not work out how to tell Tycho to reference/configure these non P2 directories. My solution for now, was to create P2 repos from my directories and to reference these in the pom using the FeaturesAndBundlesPublisher (see In the Pom replace for example the definition (“”) with something like: “file:/C:/test/p2/repository”

    After all this I have on question though. Would it be possible to run Equinox in the self plug-in discovery mode – this would save having to fiddle the config.ini?

    Thank you

    Ah – and Ilja: the url to test your installation is something like: http://localhost:8080/maildemo/mail

  11. Hi Samy,
    I also used the simpleconfigurator in a product based build to build a RAP application in some other projects. We also use a target definition which is directory based in those builds. This works too. I’m not sure if I can find the time to blog about how to build a RAP application with a product based build, sorry. But I think these are pointers and you will be able to figure out by yourself how to build this.

    Anyway, thanks for your hints ;)

  12. Michael says:


    I tried to build a rcp and rap application with single source. The part of rap I did it like this way, but with a fragment. My problem now, the fragment.xml is missing in the fragment-bundle. I used the package-type eclipse-plugin.
    What is my mistake?

  13. Did you have included the xml in your

  14. Michael says:

    Hi Holger,

    I found my mistake. The fragement.xml must be added to the
    Thanks for the fast answer.
    Another problem is to resolve optional dependencies. In my build those will be ignored.

14 responses so far

Written by . Published in Categories: Planet Eclipse

Looking for a job?

Karlsruhe / Remote
Karlsruhe / Victoria / Remote
Karlsruhe / Victoria / Remote