我正在尝试使用以下功能安装我的apache camel应用程序的最新版本:在Karaf上安装 这个新版本依赖于org.apache.commons.configuration ver 1.9 但得到以下错误
错误:
Error executing command: Could not start bundle mvn: in feature(s)<package> : Unresolved constraint in bundle <bundle> [414]: Unable to resolve 414.0: missing requirement [414.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.9.0)(!(version>=2.0.0)))
我已将其包含在pom.xml
中<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
也尝试了几种在sof中提出的方法,但没有一种方法正常工作
还将org.apache.commons.configuration放在插件
下 <plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
org.apache.cxf.service.model,
org.apache.cxf.message,
org.apache.commons.configuration,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
但仍然无法解决。有谁可以帮忙解决这个问题?
感谢
答案 0 :(得分:1)
您需要确保在Karaf中安装了jar。 为此,您需要将jar包装为一个包:
osgi:install wrap:mvn:commons-configuration/commons-configuration/1.9
完成此操作后,请确保删除您对Import-Package
所做的添加,因为它不需要。
如果您希望将依赖项与应用程序的feature
一起安装,只需将以下元素添加到您的功能中:
<bundle>wrap:mvn:commons-configuration/commons-configuration/1.9</bundle>
答案 1 :(得分:0)
您真的想从其他已部署的bundle中导入它,还是应该是一个简单的嵌入式依赖?
由于您在Import-Package
下列出,因此您需要第一个。为此,您需要在导出org.apache.commons.configuration
的容器中部署另一个捆绑包。
如果要将其作为简单依赖项嵌入到同一个包中,则必须将其从Import-Package
中以!
作为前缀排除,并且可能使用Embed-Dependency
指令,如此示例中所示回答:https://stackoverflow.com/a/30532447/8035582