How to set productionMode and compatibilityMode in OSGi environment?

With Vaadin 14.0.0 / flow 2.0.7, flow-build-info.json is created at build time and packaged into the jar containing servlet registration / servlet etc. However, the flow server tries to read it - which fails since different bundles have different class loaders in OSGi.

Setting the production mode is still possible via the @VaadinServletConfiguration annotation - but this is deprecated.

Is there another way than adding the respective system properties as start parameters for the runtime environment? Possibly one could create a fragment bundle attaching to the flow server with flow-build-info.json as only content. Not very nice, since that adds complexity to the build process, possibly with manually copying the file. Is there an easier way to make these settings available to the flow server?

EDIT: the fragment bundle solution works. It needs to contain META-INF/VAADIN/config/flow-build-info.json. As mentioned above, this is more a workaround than a final solution.


Hi Jochen,

if You are using Apache Karaf as your runtime, You are able to set custom system properties available at boot time inside $KARAF_HOME/etc/ This way I got Flow Server to recognize “vaadin.combatibilityMode” property. I am new to Vaadin and just trying to get it running. I wrote a Gradle plugin to wrap webjars with OsgiStaticResource (?) services. If You are interested, I would gladly share the code with You. Indeed fragment bundles are a nasty solution, since they are hardly watering OSGi encapsulation and have some side effects as far as I know.

Best Regards

Adrian Kania

I’m using Apache Karaf 4.2.6 as my test environment.

Hi Adrian,

thanks for the hint! I know the file (our environment is Karaf 4.2.5). However, the UI is only an optional component on our target system, and in our environment it is not easily possible to change that file when deploying the UI. That’s why I’m looking for an alternative. Some basic changes regarding Vaadin/OSGi are announced for version 15, so possibly also this issue will be resolved.

We roughly followed the OSGi starter project for Vaadin 13. I haven’t found it recently on the Vaadin Web pages, but in github it is still available. Currently we do not need a “dynamic” UI, i.e. add/remove/update UI components at runtime. The entire UI is just running in a single bundle.