我试图使用maven-bundle-plugin构建一个包,使用osgi r6元类型注释。
我已经创建了一个config类
@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的沮丧。
发布于 2015-08-28 20:01:45
我认为maven-bundle-plugin还没有使用bndlib 3.0。bndlib 3.0 (尚未发布)是OSGi R6注释支持的来源。你有点超前了。
发布于 2015-12-14 15:06:15
您的designate没有出现,因为一个还没有在类中定义。看看Neil关于这个主题的文章:在这里输入链接描述
https://stackoverflow.com/questions/32278193
复制相似问题