Shriram
Shriram

Reputation: 4411

Install dependency jar file in apache-karaf-2.3.10

I am trying to deploy an bundle in Apache karaf-2.3.10 container which inturn has jar file dependencies. After copying the dependency jar file to deploy dirctory of Apache-Karaf dependency issue got resolved. How to install the normal jar through command line. I tried the below command

osgi:install -s 'wrap:mvn:<path to the jar file/test.jar>'

which shows

Error executing command: Error installing bundles:

My bundle has lot of dependency jar files. Do i need to copy all the jar files to deploy directory? If, it will become messy. Is there any other way to point the location or creation a config file so that in activation bundles dependencies will be resolved.

Upvotes: 0

Views: 5724

Answers (1)

Achim Nierbeck
Achim Nierbeck

Reputation: 5285

Yes, and this is normal for OSGi applications. For this you can use features with Apache Karaf. So please take a look at the corresponding documentation:

Apache Karaf Provisioning and Features

a wrapped bundle in a feature might have the following "wrapped" maven coordinate:

<bundle>wrap:mvn:my.group.id/my.artifact/version</bundle>

Regarding Features Repositories, those can be of any kind, as long as the link to the repository (Feature file) can be navigated to. For Example the following are valid "coordinates":

file:/filesystem/to/my/so/awesome/features.xml
https://remote.Link.to/my/so/awesome/features.xml
mvn:my.group.id/my.artifact/version/xml/features

If your local maven repository does contain a features maven artifact it will be treated as the one to look for.

Feature repositories are added by:

feature:repo-add mvn:my.group.id/my.artifact/version/xml/features 

via karaf shell. Or added as "bootfeature" while building custom Karaf. Again, more details can be found in the documentation.

Upvotes: 1

Related Questions