2016-02-18

In my team, we're developing the Java backend of a web application. We use OSGi.

So far, during the initial development phases and to simplify things, we were using Jetty as servlet container, and for deployment to the test server we simply exported our eclipse product (everything bundled together) and ran the corresponding .exe file.

We are using OSGi for the sake of modularization and decoupling. In this particular scenario we're not interested in dynamically installing/uninstalling bundles, so the eclipse product bundling everything together and deploying it in one go was pretty convenient.

Now we want to move from Jetty to GlassFish and this means we need to package our bundles differently. From what I gather a WAB would be the right thing for us. For example see this:

Basically, [a WAB is] a web application with an OSGi bundle manifest. Thus, the whole web application can be deployed as a single OSGi bundle on any framework with WAB support. Technically, the bundle may be deployed as a web application to a Servlet container. But it gets access to a BundleContext. This allows the web application to inter-operate with other bundles or web applications running in the same framework.
http://stackoverflow.com/a/11345694/285091

Ideally, we would like to go to our .product file (or a launch configuration) and export the WAB from there, since we already have all the necessary bundles with the appropriate set up (autostart setting and start levels). However, this doesn't seem to be possible - is it?

Note that taking the "root" bundle and just packaging it and its dependencies wouldn't do the job, since there are additional bundles that would not be packaged by following that procedure. For example, in my workspace I have:

where:

com.example.something is an API bundle with 2 implementations:

com.example.something.impl.a

com.example.something.impl.b

com.example.root depends on com.example.something but not on any implementation of it

We actually run com.example.something.impl.b, never com.example.something.impl.a

If we would try to just package root and its dependencies we would miss impl.b

So, basically: given that we already have a launch configuration / eclipse product that contains the exact bundle setup we want for our server-side application, is there any way to produce a corresponding WAB? If there isn't any direct way, and given that we don't use maven (which rules out maven-bundle-plugin), what's the best next thing?

Show more