我们使用 Apache Felix maven-bundle-plugin
为我们的片段包生成 list 。此片段包旨在覆盖 Liferay host 包上的资源。 Liferay DXP documentation指定开发人员应在其 list 中包含一个 Provide-Capability
header 以覆盖主机包的资源。然而,Apache Felix maven-bundle-plugin documentation没有指定如何在插件中这样做,或者这是否可能。
我们有什么方法可以使用 Apache Felix maven-bundle-plugin
添加 Provide-Capability
header 吗?
最佳答案
对于 maven-bundle-plugin
,你只需输入 <Provide-Capability>...</Provide-Capability>
在插件配置中确保替换 ...
具有标题的所需值。
事实上,您可以添加 OSGi spec 中定义的任何 list header 。 .这是specified in the documentation如下:
The BND library underlying the plugin defines instructions to direct its behavior. For this Maven plugin, these instructions are issued in the plugin configuration section of the POM file, as was illustrated above. BND recognizes three types of instructions
1. Manifest headers - Any instruction that starts with a capital letter will appear in the resulting bundle's manifest file; the value for the header will either be copied, augmented, or generated by BND depending on the instruction.
Variables - Any instruction starting with a lowercase letter is assumed to be a variable in the form of a name-value pair, such as version=3.0, that can be used for property substitution, but is not copied to the manifest.
Directives - Any instruction starting with a '-' character is considered to be a directive that informs BND to perform some special processing and is not copied to the manifest
关于osgi - 如何在 Apache Felix maven-bundle-plugin 中设置 Provide-Capability header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57397785/