2

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

我正在使用带有 maven-bundle-plugin 的 maven 来为我在 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>

4

1 回答 1

4

如果你有这样的依赖

<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站点的“嵌入依赖项”部分中找到详细说明

于 2011-02-02T15:25:03.777 回答