我想在使用maven bundle插件创建OSGi包时从复制中排除某些包。
我在导出部分使用了!package name
。但是因为我正在使用@openejb-core-${openejb.version}.jar!/**
,所以在include-resource部分中该包被复制到包中。
如何避免使用maven bundle plugin复制特定包或一组包?
我可以在资源部分使用名称,但我不想逐一列出它们。
答案 0 :(得分:0)
通常,osgi包的构建部分如下所示:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Category>Your Category/Company</Bundle-Category>
<Import-Package>
<!-- put here some optional depependencies which are already provided by other bundles -->
org.apache.lucene.*;resolution:=optional,
*
</Import-Package>
<Export-Package>
com.yourproject.code.to.be.exported.*;version=${project.version}
<!-- exclude packages by negating with the prefix !, see http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html for more info -->
!com.do.not.include.package.*;version=x.y.z
</Export-Package>
<Embed-Dependency><!--put here some thirdparty artifacts you want to embed in your bundle--></Embed-Dependency>
<Include-Resource>{maven-resources}</Include-Resource>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
另见http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html