【发布时间】:2017-10-24 09:39:45
【问题描述】:
我想在我的 Eclipse 插件中使用 logback.slf4j,所以我将它作为一个要求添加到我的 MANIFEST.MF 文件中:
Require-Bundle: org.eclipse.equinox.app,
org.eclipse.equinox.launcher,
...,
ch.qos.logback.slf4j;bundle-version="1.0.7"
然后我通过额外的调试 (mvn clean package -X) 开始构建,在输出中我可以看到 logback.slf4j 及其依赖项已正确下载:
[INFO] Fetching 201705151400&countryCode=us&timeZone=1&format=xml from http://www.eclipse.org/downloads/download.php?format=xml&file=/releases/neon/
[INFO] Fetching ch.qos.logback.classic_1.0.7.v20121108-1250.jar.pack.gz from http://download.eclipse.org/releases/neon/201705151400/plugins/ (79,74kB)
[INFO] Fetching ch.qos.logback.classic_1.0.7.v20121108-1250.jar.pack.gz from http://download.eclipse.org/releases/neon/201705151400/plugins/ (79,74kB)
[INFO] Fetching ch.qos.logback.core_1.0.7.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (112,71kB)
[INFO] Fetching ch.qos.logback.core_1.0.7.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (112,71kB)
[INFO] Fetching org.slf4j.api_1.7.2.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (16,96kB)
[INFO] Fetching org.slf4j.api_1.7.2.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (16,96kB)
[INFO] Fetching ch.qos.logback.slf4j_1.0.7.v201505121915.jar.pack.gz from http://mirror.tspu.ru/eclipse/releases/neon/201705151400/plugins/ (7,59kB)
[INFO] Fetching ch.qos.logback.slf4j_1.0.7.v201505121915.jar.pack.gz from http://mirror.tspu.ru/eclipse/releases/neon/201705151400/plugins/ (7,59kB)
[INFO] Resolving class path of MavenProject: com.example.myplugin:com.example.myplugin:0.0.1 @ ~\Desktop\tycho_example\bundles\com.example.myplugin\.polyglot.build.properties
然后 Tycho 打印已解析的捆绑包列表,这也确认新下载的插件已正确解析:
[DEBUG] Equinox resolver state:
Resolved OSGi state
RESOLVED org.eclipse.osgi_3.11.3.v20170209-1843 : ~\.m2\repository\p2\osgi\bundle\org.eclipse.osgi\3.11.3.v20170209-1843\org.eclipse.osgi-3.11.3.v20170209-1843.jar
RESOLVED ch.qos.logback.classic_1.0.7.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.classic\1.0.7.v20121108-1250\ch.qos.logback.classic-1.0.7.v20121108-1250.jar
RESOLVED ch.qos.logback.core_1.0.7.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.core\1.0.7.v20121108-1250\ch.qos.logback.core-1.0.7.v20121108-1250.jar
RESOLVED org.slf4j.api_1.7.2.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\org.slf4j.api\1.7.2.v20121108-1250\org.slf4j.api-1.7.2.v20121108-1250.jar
RESOLVED ch.qos.logback.slf4j_1.0.7.v201505121915 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.slf4j\1.0.7.v201505121915\ch.qos.logback.slf4j-1.0.7.v201505121915.jar
RESOLVED org.eclipse.equinox.app_1.3.400.v20150715-1528 : ~\.m2\repository\p2\osgi\bundle\org.eclipse.equinox.app\1.3.400.v20150715-1528\org.eclipse.equinox.app-1.3.400.v20150715-1528.jar
...
但是,最后我得到以下信息:
NOT RESOLVED com.example.myplugin_0.0.1 : ~\Desktop\tycho_example\bundles\com.example.myplugin
Missing Constraint: Require-Bundle: ch.qos.logback.slf4j; bundle-version="1.0.7"
[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle com.example.myplugin cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle com.example.myplugin - Missing Constraint: Require-Bundle: ch.qos.logback.slf4j; bundle-version="1.0.7"
[ERROR] -> [Help 1]
有人遇到过类似的问题吗?
【问题讨论】:
-
ch.qos.logback.slf4j 是 OSGi 包吗?我不确定...
-
根据我上面包含的日志,它是从 eclipse p2 存储库下载的,所以我猜是link
标签: eclipse maven logback slf4j tycho