Hi Alan,
You basically have three options, I think. First, you could embed those non-OSGi dependencies in your bundle. The bundle will then contain the original JAR file and will be able to access the classes in that JAR file. That only works well if you never share those classes between bundles, though. Have a look at http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html and the information about Embed-Dependency there for more information on how to set this up. The other option is to create OSGi bundles for the non-OSGi dependency on-the-fly while installing it in the container, using the wrap: protocol (cfr. https://ops4j1.jira.com/wiki/display/paxurl/Wrap+Protocol). The extra instructions you're passing to the URL are the same Bnd instructions as the ones that are being used for the maven-bundle-plugin. You can also pass those instructions in a separate bnd file, which is sometimes more convenient than passing along a lot of instructions on the URL itself. Instead of wrapping the JAR on the fly, you can also create a little project that wraps the JAR as a bundle at build time. It's a bit more involved, but if you plan to reuse a bundle more often, that would probably work fine too. We use this strategy for the bundles we release ourselves, so you can always take a look at our code base for some examples, cfr. http://servicemix.apache.org/developers/source/bundles-source.html. Regards, Gert Vanthienen On Mon, Mar 24, 2014 at 3:40 PM, wabrit <[email protected]> wrote: > Hi - I'm very new to ServiceMix (and especially OSGi), and am trying to > figure out how deployment of Camel routes works when the route has 3rd party > JAR dependencies. So, apologies if this is a really basic question, but I > haven't been able to find a definitive answer anywhere. > > I've read Camel User Guide and it mentions how I can bundle my Camel route > as a Spring or Blueprint bundle, so that my Java classes that support the > route and any Spring config are loaded into the JAR assembly ready for > deployment to ServiceMix. > > What happens if my Camel route requires classes from a 3rd party non-OSGi > JAR? (e.g. I have a dependency in my project pom on that library) > > I assume OSGi has some magic to allow me to bundle that JAR in some way that > I can install it into ServiceMix/Karaf, but I'm a bit lost as to what steps > I would need to take to accomplish this. Any pointers > most appreciated. > > Many thanks > > Alan > > > > -- > View this message in context: > http://servicemix.396122.n5.nabble.com/Newbie-question-deploying-Camel-routes-with-JAR-dependencies-tp5719692.html > Sent from the ServiceMix - User mailing list archive at Nabble.com.
