【问题标题】:Maven Bundle Plugin R6 MetatypeMaven Bundle Plugin R6 元类型
【发布时间】:2015-11-23 12:53:12
【问题描述】:

我正在尝试使用maven-bundle-plugin 来构建使用osgi r6 元类型注释的包。

我已经创建了一个配置类

@ObjectClassDefinition(
    name = "Bundle State Validator"
)
@interface BundleInstallationConfig {
    boolean DEFAULT_ENABLED = true;

    @AttributeDefinition(
        defaultValue = "true"
    )
    boolean isEnabled() default DEFAULT_ENABLED;
}

我在我的组件类中使用它。

@Component(
    immediate = true
)
@Designate(ocd = BundleInstallationConfig.class)
public class BundleInstallationVerifier {
}

但是当我构建它时,生成的元类型文件看起来不正确,并且它没有加载到配置管理中。这是生成的(它缺少指定部分)

<metatype:MetaData localization="OSGI-INF/l10n/test.test.BundleInstallationConfig">
    <OCD id="test.test.BundleInstallationConfig" name="Bundle State Validator" description="Watches bundles to ensure they are in the correct state and switches the System Ready state.">
        <AD id="isEnabled" type="Boolean" name="Is enabled" default="true"/>
    </OCD>
 </metatype:MetaData>

这是我的 pom 中的捆绑插件

       <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.5.4</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <obrRepository>NONE</obrRepository>
                    <_metatypeannotations>*</_metatypeannotations>
                    <_dsannotations>*</_dsannotations>
                </instructions>
            </configuration>
        </plugin>

我之所以能走到这一步,主要是因为这家伙的挫败感 https://github.com/bndtools/bnd/issues/1030

https://groups.google.com/forum/#!msg/bndtools-users/_F0Nr8b7rlQ/2A9x660pAgAJ

【问题讨论】:

    标签: osgi maven-bundle-plugin


    【解决方案1】:

    您的designate 没有出现,因为尚未在类中定义一个。看看 Neil Bartlett 关于这个主题的帖子:enter link description here

    【讨论】:

      【解决方案2】:

      我认为maven-bundle-plugin 还没有使用 bndlib 3.0。 bndlib 3.0(尚未发布)是 OSGi R6 注释支持的来源。你有点超前了。

      【讨论】:

      • 感谢您的宝贵意见;)我在覆盖插件依赖项后下载并构建了 bnd,我能够成功构建项目并生成正确的元类型文件。
      猜你喜欢
      • 2017-04-07
      • 2013-02-10
      • 2011-05-21
      • 2013-08-19
      • 2011-06-18
      • 2016-07-11
      • 1970-01-01
      • 2013-11-15
      • 2015-02-20
      相关资源
      最近更新 更多