Install dependency jar file in apache-karaf-2.3.10

被刻印的时光 ゝ 提交于 2019-12-10 12:20:27

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/32889600/install-dependency-jar-file-in-apache-karaf-2-3-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!