使用在 OSGI 包中添加 jar 时出现问题

发布于 2024-11-14 12:16:58 字数 2289 浏览 2 评论 0原文

我正在尝试将第三方库和应用程序 jar 嵌入到 OSGI 包中。我阅读了 felix maven 插件文档并尝试使用 Embed-Dependency。但似乎没有任何效果。这是我的 pom


<dependencies>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>taxonomymessagebundle</artifactId>
            <version>1.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Export-Package>com.test.taxonomy.dao.*;version=1.0.0</Export-Package>
                        <Import-Package>*</Import-Package>
                    </instructions>
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                </configuration>
            </plugin>
        </plugins>
    </build>

,我使用 mvn clean install 来构建捆绑包。安装后,我查看了清单文件,它没有显示任何 Bundle-Classpath 或 Embed 信息。看起来它完全忽略了指令。此外,两个依赖的 jar 也没有嵌入到捆绑包中。

这是生成的清单:

code>
Manifest-Version: 1.0
Export-Package: com.test.taxonomy.dao;uses:="com.autodesk.taxonomy";version="1.0.0"
Bundle-Version: 1.0.0
Build-Jdk: 1.6.0_21
Built-By: bandops
Tool: Bnd-0.0.357
Bnd-LastModified: 1307492329392
Bundle-Name: Taxonomy Dao Bundle
Bundle-ManifestVersion: 2
Created-By: Apache Maven Bundle Plugin
Import-Package: com.test.taxonomy.dao;version="1.0",com.autodesk.test.message
Bundle-SymbolicName: com.test.taxonomy.daobundle

任何指示将不胜感激。

-谢谢

I'm trying to embed third party libs and application jar in a OSGI bundle.I read the felix maven plugin document and tried using Embed-Dependency. But it doesn't seem to have any effect. Here's my pom


<dependencies>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>taxonomymessagebundle</artifactId>
            <version>1.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Export-Package>com.test.taxonomy.dao.*;version=1.0.0</Export-Package>
                        <Import-Package>*</Import-Package>
                    </instructions>
                    <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                </configuration>
            </plugin>
        </plugins>
    </build>

I'm mvn clean install to build the bundle. After the install, I took a look into the manifest file, it doesn't show any Bundle-Classpath or Embed information. Looks like it completely ignored the instruction. Also, the two dependent jars were not embedded as well in the bundle.

Here's the generated manifest:

code>
Manifest-Version: 1.0
Export-Package: com.test.taxonomy.dao;uses:="com.autodesk.taxonomy";version="1.0.0"
Bundle-Version: 1.0.0
Build-Jdk: 1.6.0_21
Built-By: bandops
Tool: Bnd-0.0.357
Bnd-LastModified: 1307492329392
Bundle-Name: Taxonomy Dao Bundle
Bundle-ManifestVersion: 2
Created-By: Apache Maven Bundle Plugin
Import-Package: com.test.taxonomy.dao;version="1.0",com.autodesk.test.message
Bundle-SymbolicName: com.test.taxonomy.daobundle

Any pointers will be appreciated.

-Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心激荡 2024-11-21 12:16:58

均应位于 标记内。

The <Embed-Dependency> and <Embed-Transitive> should both be inside the <instructions> tag.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文