Friday, January 15, 2010

Building OSGi applications

The recent SD Times article on Virgo paints an overly bleak picture of the problems of building an OSGi application.

Build certainly complicates adopting OSGi, but many users are willing to overcome that problem in order to get the benefits of modularity and the service registry.

Also various tools are available to help. We developed the bundlor tool for automatically generating bundle manifests from the code in a bundle. Peter Kriens's bnd tool provides similar function.

People have successfully developed Maven and Ant builds for OSGi projects and various helper plugins. for instance PAX Construct, are starting to emerge.

Also, SD Times fails to mention the Enterprise Bundle Repository which already makes available (directly or via other repository front ends) about a thousand of the most popular open source Java components packaged as OSGi bundles with carefully constructed bundle manifests.


Robert Evans said...

I have a really hard time showing the value of OSGi to people when I can't easily convert their existing code that uses 3rd party jars (example drools 5.0). Classloader issues aside, manifest generation for legacy code is a dark art.

The open source java community is making progress towards OSGi compliant jars but we need a better toolkit for developers. Expecting folks to simply use what's in springsource's repo is a non starter as it simply can't scale to meet peoples needs.

All that said, once you have your bundles in place, OSGi is great.

Rob (Wishing It Were Easier) Evans

Glyn said...

The bundlor tool, linked to in the blog, is what we use for converting JARs into bundles when we add content to the Enterprise Bundle Repository. It's easy to use, so hopefully that piece of the puzzle is solved.

Anonymous said...

The article you reference is from January 2010 - I hope things have improved a bit since then! ;-)

The bigger problem I have is even convincing people that modularity is good. The "just one more hack" crowd seems to believe that anything is possible with Ant and javac, and additional tooling will only slow them down.

I've been trying to teach myself the build technologies. PDE works well, but it "feels" heavy due to needing Eclipse. Tycho is promising in concept, but it's inheriting Maven's obtuseness. I'm not a fan of spending a day googling POM snippets or downloading source code repositories to figure out how to make something work.

Glyn said...

This blog post dates back to January 2010 too and things have indeed improved on the build front. Tycho is shaping up well for those that are comfortable with Maven. Then there's bndtools. Gradle also supports building OSGi bundles via its OSGi plugin.


OSGi (130) Virgo (59) Eclipse (10) Equinox (9) dm Server (8) Felix (4) WebSphere (3) Aries (2) GlassFish (2) JBoss (1) Newton (1) WebLogic (1)