我对Tycho 0.15.0有一个奇怪的问题。我的MANIFEST.MF中有8个依赖项,但是Tycho无法解析其中之一。输出看起来像这样:

[INFO] 1 operation remaining.
[INFO] Fetching org.eclipse.xtext.logging_1.2.15.v201206120633.jar (4kB of 10.12kB at 0B/s) from http://my.server.com/p2-3.7.2/plugins/
[INFO] Resolving class path of MavenProject: <...my project ...> @ <...path to my project...>/pom.xml
[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle <...my project...> cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle <...my project...> - Missing Constraint: Require-Bundle: org.eclipse.xtext.logging; bundle-version="1.2.15"
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle <...my project...> cannot be resolved
Resolution errors:
Bundle <...my project...> - Missing Constraint: Require-Bundle: org.eclipse.xtext.logging; bundle-version="1.2.15"


我知道的:


org.eclipse.xtext.logging_1.2.15.v201206120633.jar存在
罐子没有损坏
Tycho可以从我的p2服务器下载它(我的计算机上有~/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.logging/1.2.15.v201206120633/org.eclipse.xtext.logging-1.2.15.v201206120633.jar
MANIFEST.MF看起来正确:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Bundle-Vendor: %providerName
Bundle-Localization: fragment
Fragment-Host: org.apache.log4j;bundle-version="[1.2.15,1.2.16)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.xtext.logging;singleton:=true
Created-By: 1.5.0_22-b03 (Sun Microsystems Inc.)
Bundle-Version: 1.2.15.v201206120633
Bundle-ManifestVersion: 2
Import-Package: org.eclipse.core.runtime,org.osgi.framework;version="1
.5.0"

第谷0.16.0有同样的问题。


有任何想法吗?

最佳答案

您看到此现象的原因如下:


org.eclipse.xtext.logging是片段,而不是独立的捆绑包(您可以看到,因为它在Fragment-Host中具有MANIFEST.MF,它定义了该捆绑包的另一个捆绑包)。
片段在p2中的编码方式,片段的Require-Bundle可以在p2中解析。基于p2的依存关系解决方案确定目标平台的哪些工件被下载到本地Maven存储库。
片段的Require-Bundle在OSGi服务器中无法解析。为了计算类路径(因此,控制台输出Resolving class path),Tycho使用了Equinox解析器。该解析器正确检测到该Require-Bundle to fragments is invalid

10-04 18:54