Alex Rivera | Logout

Efficient OSGi development workflow

Asked 2011-07-30T00:15:45.433
15

I work on a product composed of many bundles running as features on top of karaf. Typically our developers work on one bundle at a time. Our normal development goes something like: code, compile, copy bundle to deploy folder, test. We've also found that hotdeploy just refuses to override certain bundles that are installed as features without a server restart or a feature uninstall/reinstall, so sometimes the cycle is longer.

My question is: does anyone in the community have a better way? The way we do things works, but I feel like it's pretty slow and inefficient and I'm betting someone has come up with something better!

EDIT: I realize that I was pretty unclear in my question... We are using Equinox underneath Karaf. We also use Eclipse and Maven, although I don't know that using Maven is relevant.

Edit
Report

1 Answer

9

Sounds like you want the dev:watch command. From the documentation:

The watch command can be used to help at developement time. It allows you to configure a set of URLs that will be monitored. All bundles location matching the given URL will be automatically updated. This avoids the need for manually updating the bundles or even copying the bundle to the system folder if needed. Note that only maven based urls and maven snapshots will actually be updated automatically, so if you run

dev:watch *

It will actually monitor all bundles that have a location matching mvn:* that have '-SNAPSHOT' in their url.

Doing "dev:watch --help" from the Karaf shell will list its available flags and args.

Something similar is the PAX plugin

Either of these will work quite nicely if you've got the m2 maven plugin for Eclipse.

UPDATED: In my company we strive to be as TDD as possible, therefore a lot a development is done without explicitly starting Karaf. In the normal mix of unit tests we're also using Pax Exam, which is largely fantastic even when run from within Eclipse =)

This helps ensure we're not too tided to any Karaf specifics as it runs with Equinox/Felix/Concierge (so I mock out various Karaf specifics we depend on like JAAS authentication). Along with many other cool tools/functionality, it's capable of provisioning Karaf features and using TinyBundles you can even create bundles on the fly (again useful for mocking/stubbing).

Pax Exam hooks into the JUnit framework by providing a JUnit @Runner, the latest version (2) is much faster and has DSL ba

answered 2011-08-01T08:10:38.977

Your Answer