0

在使用 maven bundle 插件创建 OSGi 包时,我想从复制中排除一些包。

!package name在导出部分使用。但是由于我使用的是@openejb-core-${openejb.version}.jar!/**,所以在包含资源部分中,该包被复制到包中。

如何避免使用 maven bundle 插件复制特定的包或一组包?

我可以在资源部分使用名称,但我不想一一列出。

4

1 回答 1

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

于 2015-06-12T13:48:11.653 回答