【问题标题】:What is the point of a features.xml if I have to install the bundles in it manually?如果我必须手动在其中安装包,那么 features.xml 有什么意义?
【发布时间】:2016-11-29 07:00:23
【问题描述】:

我有一个 features.xml,其中列出了一些捆绑包。但显然它们都需要安装。所以 features.xml 所做的只是将依赖项收集到一个地方......

除非我大错特错。在这种情况下,如何解决我在 features.xml 中有很多依赖项并且它们都没有任何顺序的情况。现在我正在练习安装每个捆绑包并一个一个地启动它们......

告诉我我做错了什么——其中可能有几件事

编辑: 特性是由 maven 插件生成的。 当我安装功能时,我得到未解决的错误

Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=myBundleApp; type=karaf.feature; version="[1.0.0.RC1,1.0.0.RC1]"; filter:="(&(osgi.identity=myBundleApp)(type=karaf.feature)(version>=1.0.0.RC1)(version<=1.0.0.RC1))" [caused by: Unable to resolve myBundleApp/1.0.0.RC1: missing requirement [myBundleApp/1.0.0.RC1] osgi.identity; osgi.identity=org.eclipse.jetty.websocket.server; type=osgi.bundle; version="[9.3.6.v20151106,9.3.6.v20151106]"; resolution:=mandatory [caused by: Unable to resolve org.eclipse.jetty.websocket.server/9.3.6.v20151106: missing requirement [org.eclipse.jetty.websocket.server/9.3.6.v20151106] osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"]]

但是feature.xml已经有<bundle>mvn:org.eclipse.jetty.websocket/websocket-server/9.3.6.v20151106</bundle>

【问题讨论】:

  • 您的功能是什么样的?安装时出了什么问题?
  • 我通常在开发自定义 karaf 发行版的同时使用功能 xml 文件。然后它会变得更容易,因为您只需引用功能文件而不是单个捆绑包。
  • 很可能您的功能不完整,因此您需要确保那些丢失的捆绑包也包含在您的功能描述符中

标签: osgi bundle karaf


【解决方案1】:

features.xml 的重点是定义一个功能库,可用于在Apache Karaf 中配置 OSGi 应用程序。换句话说,它的目的正是不必手动安装包!正如documentation 所说:

当您安装某个功能时,Apache Karaf 会安装该功能中描述的所有资源。这意味着它将自动解析并安装该功能中描述的所有捆绑包、配置和依赖项功能。

也就是说,请记住:

  • 这是 Karaf 特有的功能。它不适用于其他 OSGi 容器
  • 在安装功能之前,您需要让 Karaf 知道包含它的存储库。您可以使用feature:repo-list 命令来检查Karaf 知道的repos 和feature:repo-add 命令来添加存储库。请参阅此documentation 了解更多详情。
  • 指向 features.xml 内的包、功能、配置等的 URL 必须指向 Karaf understands 的资源并且可以访问
  • 功能(很像捆绑包)需要在激活之前解决。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-08-01
  • 2012-02-03
  • 2018-08-18
  • 1970-01-01
  • 2021-12-25
  • 2011-03-06
  • 2016-01-21
相关资源
最近更新 更多