首页 > 解决方案 > 启动基于 Eclipse 功能的项目

问题描述

我在 Windows 10 上的 Java 10 下运行 Eclipse Photon。我使用 Xtend 而不是 Java 并使用 Eclipse E4 应用程序模板创建了一个基于 RCP 插件的项目,我可以毫无问题地启动它。但是,当我将其转换为基于功能的项目时,它无法解析 bundle com.google.guava

控制台输出在这里:

WARNING: Using incubator modules: jdk.incubator.httpclient
!SESSION 2018-07-26 09:15:52.713 -----------------------------------------------
eclipse.buildId=unknown
java.version=10.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product com.example.e4.rcp.wizard.product -clearPersistedState
Command-line arguments:  -product com.example.e4.rcp.wizard.product -data D:\WiseOldBird\Workspaces\VogellaRcpXtend/../runtime-com.example.e4.rcp.wizard.product -dev file:D:/WiseOldBird/Workspaces/VogellaRcpXtend/.metadata/.plugins/org.eclipse.pde.core/com.example.e4.rcp.wizard.product/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -clearPersistedState

!ENTRY org.eclipse.equinox.app 0 0 2018-07-26 09:15:53.916
!MESSAGE Product com.example.e4.rcp.wizard.product could not be found.

!ENTRY com.example.e4.rcp.wizard 2 0 2018-07-26 09:15:54.001
!MESSAGE Could not resolve module: com.example.e4.rcp.wizard [150]
  Unresolved requirement: Require-Bundle: com.google.guava


!ENTRY org.eclipse.osgi 4 0 2018-07-26 09:15:54.008
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
    at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
    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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1471)
An error has occurred. See the log file
D:\WiseOldBird\Workspaces\VogellaRcpXtend\.metadata\.plugins\org.eclipse.pde.core\com.example.e4.rcp.wizard.product\1532614553207.log.

我的 manifest.mf 文件是:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Wizard
Bundle-SymbolicName: com.example.e4.rcp.wizard;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: EXAMPLE
Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0",
 org.eclipse.e4.ui.model.workbench;bundle-version="0.0.0",
 org.eclipse.jface;bundle-version="0.0.0",
 org.eclipse.e4.ui.workbench;bundle-version="0.0.0",
 org.eclipse.e4.core.di;bundle-version="0.0.0",
 org.eclipse.e4.ui.di;bundle-version="0.0.0",
 com.google.guava,
 org.eclipse.xtext.xbase.lib,
 org.eclipse.xtend.lib,
 org.eclipse.xtend.lib.macro
Bundle-RequiredExecutionEnvironment: JavaSE-9
Import-Package: javax.annotation;version="0.0.0"
Automatic-Module-Name: com.example.e4.rcp.wizard

我的 feature.xml 文件是:

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="com.example.e4.rcp.wizard.feature"
      label="Feature"
      version="1.0.0.qualifier">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

   <requires>
      <import plugin="javax.inject"/>
      <import plugin="org.eclipse.core.runtime"/>
      <import plugin="org.eclipse.swt"/>
      <import plugin="org.eclipse.e4.ui.model.workbench"/>
      <import plugin="org.eclipse.jface"/>
      <import plugin="org.eclipse.e4.ui.services"/>
      <import plugin="org.eclipse.e4.ui.workbench"/>
      <import plugin="org.eclipse.e4.core.di"/>
      <import plugin="org.eclipse.e4.ui.di"/>
      <import plugin="org.eclipse.e4.core.contexts"/>
      <import plugin="org.eclipse.xtext.xbase.lib"/>
      <import plugin="org.eclipse.xtend.lib"/>
      <import plugin="org.eclipse.xtend.lib.macro"/>
      <import plugin="javax.annotation"/>
      <import plugin="com.google.guava"/>
   </requires>

   <plugin
         id="com.example.e4.rcp.wizard"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>

我需要做什么才能将其作为基于功能的项目启动?

标签: eclipse-rcpxtend

解决方案


import在 feature.xml 中意味着其他一些功能提供了这些插件。如果您只指定您的功能,则不会找到它们。

对于 e4 org.eclipse.e4.rcporg.eclipse.emf.commonorg.eclipse.emf.ecore特性也应该包含在产品文件或运行配置中。

不在其他功能中的插件应列在 feature.xml 的“包含的插件”列表中


推荐阅读