1

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 {
}

しかし、ビルドすると、生成されたメタタイプ ファイルが正しく表示されず、config admin に読み込まれません。これが生成されたものです(指定セクションがありません)

<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

4

2 に答える 2

-1

Yourdesignateはクラスで定義されていないため表示されません。このトピックに関する Neil Bartlett の投稿をご覧ください:ここにリンクの説明を入力してください

于 2015-12-14T15:06:15.430 に答える