2
votes

I got a 3rd party jar which I am using for Blowfish decryption in a bundle that I need to deploy on apache karaf.

So now I also need karaf to know this jar but every solution I find is about creating a whole bundle for that jar which is pretty much for a simple library imo.

What I already did is installing that jar in my local maven repository and adding the dependency but this also doesn't work (at least on karaf).

Is there any other way to get 3rd party jars on apache karaf to work?

2
"So now I also need karaf to know this jar" -- What does this mean? What problem are you actually trying to solve? - Neil Bartlett
I'm trying to use a 3rd party .jar in a bundle which is running on apache karaf - Milla

2 Answers

2
votes

Are you using a features xml file? If so you could use wrap:mvn: to make it available:

<feature name="feature1" version="1.0.0">
  <bundle>wrap:mvn:group.id/third.party.artefact.id/version</bundle>
  <bundle>mvn:group.id/your.artefact/version</bundle>
</feature>

This will bundle the third party jar at runtime and make sure it's installed for your bundle to use. Taken from Karaf - Creating bundles

0
votes

In addiction to @fiw you may want to osgify your thirdparty jar using Bndtools. In order to achive it:

  1. Download bnd tools
  2. Open a shell where you have downloaded bnd-2.4.0.jar.
  3. Type:

    java -jar bnd-2.4.0.jar wrap -o osgify-dependency.jar dependency.jar

where dependency.jar is your third party and osgify-dependency.jar will be the output.

  1. Deploy to maven repo overriding the previous maven coordinates, or deploy your thirdparty with different coordinates.

    mvn deploy:deploy-file -Dfile osgify-dependency.jar ...