首页 > 解决方案 > 卡拉夫想要可选的进口?

问题描述

我正在尝试在 Karaf 中使用 org.eclipse.persistence.moxy 2.7.4。

卡拉夫 4.2.6 说:

Error executing command: Error executing command on bundles:
        Error starting bundle 71: Unable to resolve HelloWorld [71](R 71.0): missing requirement [HelloWorld [71](R 71.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.codemodel) Unresolved requirements: [[HelloWorld [71](R 71.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.codemodel)]

我认为这是因为 moxy 的 META-INF 包括:

Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.persistence.moxy
Require-Bundle: org.eclipse.persistence.core;bundle-version="2.7.4";visibility:=reexport,org.eclipse.persistence.asm;bundle-version="7.0.0" ;resolution:=optional
Bundle-ManifestVersion: 2
Bundle-Vendor: Eclipse.org - EclipseLink Project
Import-Package: com.sun.xml.bind;resolution:=optional,com.sun.xml.bind.annotation;resolution:=optional,com.sun.xml.bind.api;resolution:=optional,com.sun.xml.bind.api.impl;resolution:=optional,com.sun.codemodel;resolution:=optional;version="[2.2.11,3)"
Bundle-Name: EclipseLink MOXy
Bundle-Version: 2.7.4.v20190115-ad5b7c6b2a

笔记com.sun.codemodel;resolution:=optional;version="[2.2.11,3)

但它说“分辨率:=可选”。那么为什么这是一个未解决的要求,我怎样才能让 karaf 将其视为可选?

标签: apache-karafapache-felixmoxybnd

解决方案


请注意,在这里,抱怨找不到那个包的不是 moxy,而是你自己的服务。检查您Import-PackageMETA-INF/MANIFEST.MF,如果您使用 maven-bundle-plugin,则可能会通过您的 pom.xml 扫描依赖项,然后在您的Import-Package子句中推断。


推荐阅读