如何将 jar 添加到 Apache Felix 中的包中?
我正在使用 maven,通过 maven-bundle-plugin 来管理 OBR 中的包。
但是我不确定在哪里声明 POM 中对 jar 的依赖关系,以便 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>
最佳答案
如果你有这样的依赖
<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 的“嵌入依赖项”部分找到详细说明。网站
关于osgi - 在Pom文件中将jar添加到apache felix?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4875648/