So OSGi has been on my radar for a while. I got a chance to have a good play with it, and I don't think I actually came out on top. So rather than bore you with my tales of woe, let me describe my OSGi Utopia:
Effortless builds
Ideally, I'd be able to declare
bundle in my maven pom and that would be the end of it. That's right. No messing around with bnd or bundlor configuration. As a total newbie, figuring out what should go in the manifest was arguably the hardest part. A lot of that info is contained in my maven pom, so why do I need to specify it again just for the manifest?
Effortless deployment
With a classic war, I can simply run 'mvn jetty:run' and bang!, my project is deployed to a jetty instance that magically materialises out of no where. No dicking around. Not only that, I can tell maven to start up and deploy to an embedded jetty instance which runs in the background for integration tests, and tear down that instance later. Again, with near zero configuration. I might have to give it a config file that declares my data sources etc, but that's about it.
Effortless provisioning
Again, I'll look to the maven ecosystem for a good example. Maven repositories, (I rather like Nexus in particular) can be taught about other repositories, and it can download artefacts from these repositories on the fly.
I only played with DM Server, so your experiences may vary, but as of the moment, it looks like DM Server can only look at other DM Servers for remote hosted repositories. There's an issue to get support for the main EBR, but really, why can't I just point it at our local Nexus installation, which knows how to find aforementioned bundles for my build. Why is it so hard to find the same bundles for runtime?
Another big promise of OSGi is the end of classpath hell. That is another area where DM Server has unfortunately fallen flat on it's face. It was quite easy to screw up DM Server's boot classpath, and I managed to do so by trying to shoehorn my local maven repo into DM Server.
Granted, DM Server 2.0.0 is only a milestone release, but I really don't want to place bets on something that might not exist by the time a project goes live.
In summary…
OSGi does promise a lot, but the compromises needed to make good on those promises are just not worth it, with current tools. I can live with having to fudge around manifests, or do manifest-first development, but not being able to quickly provision an environment for my bundles to run is an absolute deal breaker.