【问题标题】:Add jar to apache felix in Pom file?在 Pom 文件中将 jar 添加到 apache felix?
【发布时间】:2011-02-02 14:33:29
【问题描述】:

如何在 Apache Felix 中将 jar 添加到我的包中?

我正在使用 maven 和 maven-bundle-plugin 为我在 OBR 中管理我的包。

但我不确定在 jar 上的 POM 中在哪里声明依赖项,以便 maven 正确地将其编译到最终包中。

这是我的插件在 pom 中的样子:

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<configuration>
    <instructions>
        <Bundle-Category>sample</Bundle-Category>
        <Bundle-SymbolicName>${artifactId}
                 </Bundle-SymbolicName>
        <Export-Package>
            //blahblah
        </Export-Package>
    </instructions>

    <!-- OBR -->
    <remoteOBR>repo-rel</remoteOBR>
    <prefixUrl>file:///C:/Users/blah/Projects/Eclipse3.6-RCP-64/Felix/obr-repo/releases</prefixUrl>
    <ignoreLock>true</ignoreLock>
</configuration>

【问题讨论】:

    标签: osgi apache-felix


    【解决方案1】:

    如果你有这样的依赖

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>
    

    您可以使用

    将其嵌入到您的捆绑包中
    <instructions>
        <!-- embedded dependencies -->
        <Embed-Dependency>log4j;groupId=log4j;inline=false</Embed-Dependency>
    </instructions>
    

    您可以在Bundle Plugin for Maven 站点的“嵌入依赖项”部分找到详细说明

    【讨论】:

    • 太棒了——我实际上看到它在清单文件中生成了一个“Bundle-Classpath”——这是一个 OSGI 指令。非常感谢!
    猜你喜欢
    • 2017-03-17
    • 2017-06-16
    • 2015-11-29
    • 2021-03-24
    • 2022-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多