Can anyone share his or her experiences developing OSGi bundles with Karaf?

Is anyone using Intellij to develop OSGi bundles using Karaf and can share how he or she is doing so?

I can build and run my bundles as a plain-vanilla Java application using "ant" and even debugged my code in IntelliJ as a straight application.  The osmorc plugin gives unhelpful error messages about not find anything in my manifest.   It looks like the IntelliJ plug-in might not be supported in the future and it doesn't allow for karaf in any case.  It looks like I will have to turn it off.

I'm maintaining a working ant build so I can work through all the examples in the OSGi book I am using.  The build.xml is really simple and I enjoy having visibility into the build process.

(Feel free to suggest Maven suggestions for the benefit of anyone following this thread, but I will not be using it.  To head off the inevitable discussion, my last three projects at three different companies - independently - ended up taking Maven out because of the loss of productivity and schedule time from debugging other people's messed up archteypes, POMs and repos.  This expense far outweighed the initial convenience.)

The issues I found trying to use IntelliJ is the mismatch between bundles, the classpath, and launching applications.  I can get clean compiles by adding a bundle .jar file in the karaf/felix deploy/bundles directory to the classpath but that does not limit access to packagess that are not actually exported.  Therefore I can build stuff that won't run.

Second, I can make a launch target but IntelliJ wants just one of my modules (bundles) to debug, when really I want all of the modules (bundles) to be debugged and I don't want IntelliJ getting involved in using my module compiler output directory at all.

Lessons learned from someone actually doing OSGi with karaf will be most highly appreciated.

Tim

Please sign in to leave a comment.