Vaadin + OSGi + Tycho

Hi,

I want to build an OSGi Vaadin app with Tycho, but I have some problems.

I created a simple custom Vaadin Addon bundle and I have to use some other “official” Vaadin Addon jars too. I would like to compile and copy all Addon widgetsets into my main Vaadin bundle, under the Tycho build process. The vaadin-maven-plugin find all of my resources, but don’t compile all widgetsets & styles, only one (my custom created Addon bundle → ‘com.example.myapplication.WidgetSet’):



auto discovered modules [com.example.myapplication.WidgetSet]

[INFO]
Updating widgetset com.example.myapplication.WidgetSet


Widgetsets found from classpath:
[INFO]
org.vaadin.treegrid.WidgetSet in jar:file:…/com.test.vaadin/bundles/com.test.vaadin.simple/libs/vaadin-treegrid-0.7.0.jar!/
[INFO]
fi.jasoft.qrcode.QrcodeWidgetset in jar:file:…/.m2/repository/org/vaadin/addons/qrcode/2.0.1/qrcode-2.0.1.jar!/
[INFO]
com.example.myapplication.WidgetSet in file:…/com.test.vaadin/bundles/com.test.vaadin.simple/src
[INFO]
com.vaadin.DefaultWidgetSet in jar:file:…/com.test.vaadin/bundles/com.test.vaadin.libs/lib/com.vaadin.client_7.7.6.jar!/
[INFO]
Addon styles found from classpath:
[INFO]
VAADIN/addons/treegrid/treegrid.scss in jar:file:…/com.test.vaadin/bundles/com.test.vaadin.simple/libs/vaadin-treegrid-0.7.0.jar!/


auto discovered modules [com.example.myapplication.WidgetSet]

[INFO]
Compiling module com.example.myapplication.WidgetSet
[INFO]
Computing all possible rebind results for ‘com.vaadin.client.metadata.ConnectorBundleLoader’

I attached the relevant pom.xmls

Have anyone any idea, whats wrong or missed?

Thanks
29426.xml (1.66 KB)
29427.xml (1.77 KB)
29428.xml (3.93 KB)

You only need to compile and package one widgetset - the application widgetset whose .gwt.xml file refers to the add-ons. The compiled widgetset will then include the add-ons in its JS. Thus, the log looks correct - when it says it found the other widgetsets, that was when it was updating your application widgetset to refer to them.

Are you seeing some problems when actually running your application?

One potential issue with OSGi is that if you have multiple bundles which include files that should go under /VAADIN - e.g. your widgetset in one bundle, the botstrap JS file in another and the themes in a third one. OSGi expects each package to be located completely within one bundle. I’m not an expert on this, but there should be various solutions to this “split package” problem - one would be to build a bundle that includes all the static resources you need in /VAADIN. Search for recent examples of Vaadin and OSGi for examples of that and other, perhaps simpler alternatives - e.g. Florian Pirchner has published various examples and approaches over the years.