Tycho下载依赖但未能解决它

时间:2012-11-21 09:01:26

标签: dependencies osgi tycho

我对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"

我所知道的:

  1. jar org.eclipse.xtext.logging_1.2.15.v201206120633.jar存在
  2. 罐子没有损坏
  3. Tycho可以从我的p2服务器下载它(我的电脑上有~/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.logging/1.2.15.v201206120633/org.eclipse.xtext.logging-1.2.15.v201206120633.jar
  4. 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"
    
  5. Tycho 0.16.0也存在同样的问题。

  6. 有什么想法吗?

1 个答案:

答案 0 :(得分:5)

您看到此行为的原因如下:

  • 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