【发布时间】:2023-04-03 13:30:01
【问题描述】:
我有一个 OSGi 项目,其中包含带有编译范围的 sesame-runtime-osgi 依赖项。
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime-osgi</artifactId>
<version>${sesame.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
sesame-runtime-osgi 工件包括几个运行时依赖项。例如:
+- org.openrdf.sesame:sesame-runtime-osgi:jar:2.7.13:compile
| +- org.openrdf.sesame:sesame-http-client:jar:2.7.13:compile
| | +- org.openrdf.sesame:sesame-http-protocol:jar:2.7.13:compile
| | | \- org.openrdf.sesame:sesame-rio-ntriples:jar:2.7.6:compile
| | | \- commons-io:commons-io:jar:2.1:compile
| | +- org.openrdf.sesame:sesame-query:jar:2.7.13:compile
.
.
.
| | \- commons-codec:commons-codec:jar:1.4:runtime
| \- org.openrdf.sesame:sesame-http-server-spring:jar:2.7.13:compile
| +- org.openrdf.sesame:sesame-runtime:jar:2.7.6:compile
| | +- org.openrdf.sesame:sesame-repository-manager:jar:2.7.13:compile
.
.
.
| | +- org.openrdf.sesame:sesame-queryresultio-sparqljson:jar:2.7.13:runtime
| | | \- com.fasterxml.jackson.core:jackson-core:jar:2.2.2:runtime
| | +- org.openrdf.sesame:sesame-queryresultio-text:jar:2.7.13:runtime
| | | \- net.sf.opencsv:opencsv:jar:2.0:runtime
.
.
.
| \- cglib:cglib:jar:2.2:compile
| \- asm:asm:jar:3.1:compile
您会注意到“net.sf.opencsv:opencsv:jar:2.0”是一个运行时依赖项,因此它不包含在由 karaf-maven-plugin 生成的 feature.xml 中。不幸的是,运行时所需的包包含在 sesame-runtime-osgi Manifest 的“Import-Packages”指令中:
Import-Package: au.com.bytecode.opencsv
所以除非我自己手动包装和部署运行时依赖项,否则 Karaf 无法部署该功能。显然我不想这样做。
有没有办法可以在 feature.xml 生成中包含运行时范围的依赖项?
谢谢
【问题讨论】:
-
因为您没有说您使用的是哪个版本的 Karaf maven 插件,您是否 a) 尝试使用 3.0.2,b) 最新快照和 c) 通常最好在karaf 的邮件列表。
-
对不起,我已经用 3.0.2 和 4.0.0.M1 试过了。 maven-shade-plugin 也会发生类似的情况,但它是通过使用 ServicesResourceTransformer 修复的。我刚刚向用户列表发送了一条消息。感谢您的提示!
标签: maven osgi apache-karaf sesame karaf