且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用maven bundle插件在OSGi包中包含一个依赖jar?

更新时间:2022-02-07 02:11:36

好像我需要部署 h2-1.3.158.jar 以及我的捆绑包并添加在 pom.xml 中进行一些编辑,如下所示:

It seems like I needed to deploy the h2-1.3.158.jar along with my bundle and add the make some edits in the pom.xml as follows:

<build>
<defaultGoal>install</defaultGoal>
<plugins>
    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Export-Package>
                    com.ct.service.userService.*,
                    <!--org.h2.*    No need to export these dependency -->
                </Export-Package>
                <Import-Package>
                    *,
                    org.codehaus.jackson.jaxrs,
                    org.h2               <!-- Needed to import the dependencies. -->
                </Import-Package>
                <!--<Embed-Dependency>h2</Embed-Dependency> No need of embedding -->
            </instructions>
        </configuration>
    </plugin>
</plugins>