2012-06-14 46 views
1

我有一个问题需要使用Maven构建我的OSGI服务。我pom.xml使用Maven构建OSGI声明性服务

<plugin> 
    <groupId>org.apache.felix</groupId> 
    <artifactId>maven-bundle-plugin</artifactId> 
    <version>2.0.1</version> 
    <extensions>true</extensions> 
    <configuration> 
     <instructions> 
      <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> 
      <Service-Component>OSGI-INF/activator.xml</Service-Component> 
      <Import-Package>org.osgi.framework</Import-Package> 
     </instructions> 
    </configuration> 
</plugin> 

当我建立与Maven的安装也不生成.jar文件,但OSGI-INF文件夹不存在。我使用Eclipse和m2e插件。为什么OSGI-INF文件夹不在.jar文件中?

回答

1

所以,如果你想使用bnd的内部注释框架,你不需要对felix scr插件的依赖。

<dependency> 
     <groupId>biz.aQute</groupId> 
     <artifactId>bndlib</artifactId> 
     <version>1.50.0</version> 
    </dependency> 

一旦你这样做,你可以告诉BND生成带有此配置选项的行家束-插件声明服务XML:

<Service-Component>*</Service-Component> 

这将产生对OSG-INF东西您。注解略有不同,他们在这里记录:http://www.aqute.biz/Bnd/Components

而且,你是进口看起来很时髦,我会推荐这:

<instructions> 
     <Export-Package>{local-packages};version="${project.version}"</Export-Package> 
     <Import-Package>*</Import-Package> 
     <Private-Package>{local-packages}</Private-Package> 
     <Service-Component>*</Service-Component> 
    </instructions> 
+0

有,我可以用我的准备激活任何方式。 XML没有注释? –

+0

嗯,是的,但注释非常好,自动生成一切为你;) – bluejekyll

+0

所以在我的项目中我们有一个类似的问题,试试这个:<_include> OSGI-INF/activator.xml bluejekyll

相关问题