How to deploy a karaf feature from a local maven repository?

耗尽温柔 提交于 2019-12-07 08:30:38

问题


I've created by first project for karaf (4.0.1). So far I've got the following:

  • an application bundle built with the maven-bundle-plugin. There are going to be more...
  • a karaf feature created with the karaf-maven-plugin.
  • a karaf-assembly created with the same plugin

So I'm ready to deliver to the customer - but I'm stuck over the development process. This question answered almost all my remaining questions save one:

After having built my project by running maven install I think I should be able to to get my feature running on a local karaf instance using something like the command feature:install.

I can install my application bundle from local maven by using bundle:install but then I'm down to managing dependencies myself.

Really can't figure out while bundle:install works against my local maven repository and feature:install doesn't.


回答1:


Found the soloution here. I knew I'd need feature:repo-add - but the name of this command and the official documentation sent me thinking in entirely the wrong direction.

This command does not add a (maven) repository, but adds the location of a feature in the maven repository chain (so I'm thinking the old name addUrl was probably easier to understand).

Anyway - using feature:repo-add mvn:<groupId>/<artifactId>/<version>/xml/features works.




回答2:


I've just had the similar issue and I've found solution here: http://karaf.922171.n3.nabble.com/Add-additional-local-maven-repository-how-td4028299.html

I've edited the etc/org.ops4j.pax.url.mvn.cfg and uncommented the option org.ops4j.pax.url.mvn.localRepository, setting it to my local repository location:

org.ops4j.pax.url.mvn.localRepository=C:/data/maven-repo



回答3:


Before installing a feature, you have to register the features repository that provides the feature using feature:repo-add

using feature:repo-add mvn:<groupId>/<artifactId>/<version>/xml



来源:https://stackoverflow.com/questions/32847252/how-to-deploy-a-karaf-feature-from-a-local-maven-repository

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