将 Guava 添加到依赖项后,基于插件的 RCP 产品构建不会 运行

Plug-in Based RCP Product build won't run after adding Guava to dependencies

我有一个基于插件的 RCP 应用程序,我将其作为产品导出,在我添加 Guava 库之前,它运行良好。我将 Guava-23.0 库添加到项目并将插件添加到依赖项(但出于某种原因它将 guava 插件列为 21.0 而不是 23.0?),然后它运行当我从 Eclipse 测试时很好。

但是,当我导出产品然后尝试打开应用程序时,它没有启动,而是创建了这个巨大的错误文件:

!SESSION 2017-12-13 12:18:54.650 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_144
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -clearPersistedState
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -clearPersistedState

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.114
!MESSAGE Could not install bundle plugins/ch.qos.logback.classic_1.0.7.v20121108-1250.jar   A bundle is already installed with the name "ch.qos.logback.classic" and version "1.0.7.v20121108-1250"

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.114
!MESSAGE Could not install bundle plugins/ch.qos.logback.core_1.0.7.v20121108-1250.jar   A bundle is already installed with the name "ch.qos.logback.core" and version "1.0.7.v20121108-1250"

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.130
!MESSAGE Could not install bundle plugins/ch.qos.logback.slf4j_1.0.7.v201505121915.jar   A bundle is already installed with the name "ch.qos.logback.slf4j" and version "1.0.7.v201505121915"

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.130
!MESSAGE Could not install bundle plugins/com.google.guava_15.0.0.v201403281430.jar   A bundle is already installed with the name "com.google.guava" and version "15.0.0.v201403281430"

//**A bunch of the same error for difference bundles here** 

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.614
!MESSAGE Could not install bundle plugins/org.w3c.dom.svg_1.1.0.v201011041433.jar   A bundle is already installed with the name "org.w3c.dom.svg" and version "1.1.0.v201011041433"

!ENTRY org.eclipse.update.configurator 4 0 2017-12-13 12:18:56.614
!MESSAGE Could not install bundle plugins/sample_1.0.0.201712131218.jar   A bundle is already installed with the name "sample" and version "1.0.0.201712131218"

!ENTRY org.eclipse.help.base 4 0 2017-12-13 12:18:56.677
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.help.base [117]
  Unresolved requirement: Require-Bundle: org.apache.lucene.core; bundle-version="[6.1.0,7.0.0)"
  Unresolved requirement: Require-Bundle: org.apache.lucene.analyzers-common; bundle-version="[6.1.0,7.0.0)"
    -> Bundle-SymbolicName: org.apache.lucene.analyzers-common; bundle-version="6.1.0.v20161115-1612"
       org.apache.lucene.analyzers-common [22]
         Unresolved requirement: Import-Package: org.apache.lucene.document; core="split"; version="[6.1.0,6.2.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.help.ui 4 0 2017-12-13 12:18:56.693
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.help.ui [118]
  Unresolved requirement: Require-Bundle: org.eclipse.help.base; bundle-version="[4.0.0,5.0.0)"; visibility:="reexport"
    -> Bundle-SymbolicName: org.eclipse.help.base; bundle-version="4.2.101.v20171009-0410"; singleton:="true"
       org.eclipse.help.base [117]
         Unresolved requirement: Require-Bundle: org.apache.lucene.core; bundle-version="[6.1.0,7.0.0)"
         Unresolved requirement: Require-Bundle: org.apache.lucene.analyzers-common; bundle-version="[6.1.0,7.0.0)"
           -> Bundle-SymbolicName: org.apache.lucene.analyzers-common; bundle-version="6.1.0.v20161115-1612"
              org.apache.lucene.analyzers-common [22]
                Unresolved requirement: Import-Package: org.apache.lucene.document; core="split"; version="[6.1.0,6.2.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.m2e.core 4 0 2017-12-13 12:18:56.693
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.m2e.core [143]
  Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="[21.0.0,22.0.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.m2e.core.ui 4 0 2017-12-13 12:18:56.693
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.m2e.core.ui [144]
  Unresolved requirement: Require-Bundle: org.eclipse.m2e.core; bundle-version="[1.8.1,1.9.0)"
    -> Bundle-SymbolicName: org.eclipse.m2e.core; bundle-version="1.8.2.20171007-0217"; singleton:="true"
       org.eclipse.m2e.core [143]
         Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="[21.0.0,22.0.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.equinox.app 0 0 2017-12-13 12:18:57.145
!MESSAGE Product sample.product could not be found.

!ENTRY org.eclipse.m2e.core 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.eclipse.m2e.core [143]
  Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="[21.0.0,22.0.0)"


!ENTRY org.apache.lucene.analyzers-smartcn 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.apache.lucene.analyzers-smartcn [23]
  Unresolved requirement: Import-Package: org.apache.lucene.analysis; version="[6.1.0,6.2.0)"


!ENTRY org.eclipse.help.ui 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.eclipse.help.ui [118]
  Unresolved requirement: Require-Bundle: org.eclipse.help.base; bundle-version="[4.0.0,5.0.0)"; visibility:="reexport"
    -> Bundle-SymbolicName: org.eclipse.help.base; bundle-version="4.2.101.v20171009-0410"; singleton:="true"
       org.eclipse.help.base [117]
         Unresolved requirement: Require-Bundle: org.apache.lucene.analyzers-common; bundle-version="[6.1.0,7.0.0)"
           -> Bundle-SymbolicName: org.apache.lucene.analyzers-common; bundle-version="6.1.0.v20161115-1612"
              org.apache.lucene.analyzers-common [22]
                Unresolved requirement: Import-Package: org.apache.lucene.document; core="split"; version="[6.1.0,6.2.0)"


!ENTRY org.eclipse.m2e.logback.appender 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.eclipse.m2e.logback.appender [145]
  Unresolved requirement: Require-Bundle: org.eclipse.m2e.core.ui; bundle-version="[1.8.1,1.9.0)"
    -> Bundle-SymbolicName: org.eclipse.m2e.core.ui; bundle-version="1.8.2.20171007-0217"; singleton:="true"
       org.eclipse.m2e.core.ui [144]
         Unresolved requirement: Require-Bundle: org.eclipse.m2e.core; bundle-version="[1.8.1,1.9.0)"
           -> Bundle-SymbolicName: org.eclipse.m2e.core; bundle-version="1.8.2.20171007-0217"; singleton:="true"
              org.eclipse.m2e.core [143]
                Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="[21.0.0,22.0.0)"


!ENTRY org.apache.lucene.analyzers-common 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.apache.lucene.analyzers-common [22]
  Unresolved requirement: Import-Package: org.apache.lucene.document; core="split"; version="[6.1.0,6.2.0)"


!ENTRY org.eclipse.m2e.core.ui 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.eclipse.m2e.core.ui [144]
  Unresolved requirement: Require-Bundle: org.eclipse.m2e.core; bundle-version="[1.8.1,1.9.0)"
    -> Bundle-SymbolicName: org.eclipse.m2e.core; bundle-version="1.8.2.20171007-0217"; singleton:="true"
       org.eclipse.m2e.core [143]
         Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="[21.0.0,22.0.0)"


!ENTRY org.eclipse.help.base 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.eclipse.help.base [117]
  Unresolved requirement: Require-Bundle: org.apache.lucene.analyzers-common; bundle-version="[6.1.0,7.0.0)"
    -> Bundle-SymbolicName: org.apache.lucene.analyzers-common; bundle-version="6.1.0.v20161115-1612"
       org.apache.lucene.analyzers-common [22]
         Unresolved requirement: Import-Package: org.apache.lucene.document; core="split"; version="[6.1.0,6.2.0)"


!ENTRY org.apache.lucene.misc 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: org.apache.lucene.misc [25]
  Unresolved requirement: Import-Package: org.apache.lucene.analysis; version="[6.1.0,6.2.0)"


!ENTRY sample 2 0 2017-12-13 12:18:57.504
!MESSAGE Could not resolve module: sample [216]
  Unresolved requirement: Require-Bundle: com.google.guava; bundle-version="21.0.0"


!ENTRY org.eclipse.osgi 4 0 2017-12-13 12:18:57.504
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
    at org.eclipse.emf.common.util.URI$URIPool$PlatformAccessUnit.setValue(URI.java:865)
    at org.eclipse.emf.common.util.URI$URIPool.intern(URI.java:1949)
    at org.eclipse.emf.common.util.URI.createPlatformPluginURI(URI.java:2718)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.determineApplicationModelURI(E4Application.java:408)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:349)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:253)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:149)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)

我这辈子都想不通为什么会这样或如何解决它。

经过更深入的研究,我找到了解决问题的方法。这似乎是某种错误,但解决方法是在产品文件的内容选项卡下手动指定 com.google.guava 和 org.apache.lucene.core 的确切版本。

this answer to the same question on the Eclipse bugzilla