Apache Karaf 特性依赖

Apache Karaf feature dependency

在 feature.xml(Apache Karaf 供应机制)中,标记 feature 具有 dependency 属性。这个属性有什么作用?

例如:

<feature dependency="true">custom-feature-name</feature>

在哪里可以找到有关它的任何信息?

经过简短的谷歌搜索后,我只在 bundle 标签上找到了 dependency 属性:

The role of the dependency attribute is to mark that a bundle is a dependency. If a dependency is already satisfied (an existing bundle already exports the same packages/version) then it doesn't get installed. This behavior happens if the declared feature resolver is installed (e.g. obr is installed).

来源: http://karaf.922171.n3.nabble.com/features-xml-dependency-quot-true-quot-td3286359.html

但是,仍然没有关于功能标签的信息。

似乎features的依赖定义在

<feature name="${project.name}-cxf" version="${cxfVersion}" description="Gets CXF up and running." install="auto">
    <feature version="${cxfVersion}" dependency="true">cxf</feature>
</feature>

意味着功能 ${project.name}-cxf 不必启动 cxf,因为它声明其他东西将提供它。这确实是违反直觉的。是谁提出了这个可笑的用词不当?

要自动安装cxf,实际上应该设置为false。当 dependency="true" 并再次设置为 false 时,可以通过查找功能 ${project.name}-cxf 的名称来验证这一点。

Karaf 的开发者,dependency=false 应该重命名为 provided=true