Search code examples
javaeclipseosgiosgi-bundle

Working with multiple OSGi bundles in Eclipse


I'm currently learning how to work with OSGi, and I've got a little question that I can't seem to Google an answer for.

I'm trying to build a backend for my mobile app, and the backend will connect to several downstream nodes. Currently, this backend would initially support only my mobile app, but I plan to shift my web portal to use it as well.

Looking at how OSGi allows me to have modularize my code into several bundles, this is what I have in mind:

Backend
|--- osgi-mobile
|--- osgi-webportal
|--- osgi-downstreamnode1
|--- osgi-downstreamnode2

My problem lies with using/consuming the services from a downstream node bundle in a front-end bundle (e.g. osgi-mobile using/consuming services from osgi-downstreamnode1).

I'm currently building them in Eclipse Mars, and short of packaging the entire osgi-downstreamnode1 bundle into a JAR, and importing it into the osgi-mobile bundle, I can't seem to figure out how to reference the bundles in Eclipse, as well as have the osgi-mobile bundle call the other bundles during runtime.


Solution

  • Thanks for your help!

    Through some trial and error, I have managed to get what I want via the Export-Package option and Import-Package option via MANIFEST.MF. I have run into another set of problems regarding the usage of third-party JARs, but I will post that in a new question.