我对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
存在~/.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"
Tycho 0.16.0也存在同样的问题。
有什么想法吗?
答案 0 :(得分:5)
您看到此行为的原因如下:
org.eclipse.xtext.logging
是一个片段,而不是一个独立的包(你可以看到它,因为它在Fragment-Host
中有MANIFEST.MF
,它定义了这个片段所属的另一个包。) Require-Bundle
可以在p2中解析。基于p2的依赖项解析确定将目标平台的哪些工件下载到本地Maven存储库。Require-Bundle
将无法在OSGi服务器中解析。为了计算类路径(因此控制台输出Resolving class path
),Tycho使用Equinox解析器。该解析器正确检测到Require-Bundle to fragments is invalid。