【发布时间】:2015-12-18 17:37:47
【问题描述】:
我正在完成 Vogella Eclipse RCP 书(第 3 版)中基于“Todo”功能的 RCP 练习(“从插件到 Eclipse RCP”),但我无法启动该应用程序。据我了解,练习的目的是从一个插件项目开始,并使用插件作为应用程序的基础,手动构建一个简单的基于功能的 RCP 应用程序。我在 Mac 上运行 Mars 版本 (4.5.1)。我得到的错误是:
!SESSION 2015 年 12 月 18 日星期五 07:57:00 EST ------------------------------------------ !ENTRY org.eclipse.equinox。发射器 4 0 2015-12-18 07:57:00.091 !消息 启动 Eclipse 平台时出现异常:!STACK java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter 在 java.net.URLClassLoader$1.run(URLClassLoader.java:366) 在 java.net.URLClassLoader$1.run(URLClassLoader.java:355) 在
等等……
这个问题可能与缺少依赖关系有关,我追溯到两个相关的观察结果。
首先,todo.product 编辑器不包含本书中描述的依赖项选项卡。相反,内容选项卡包含构成产品的功能列表。当我单击“添加必需”按钮时,在该编辑器/选项卡中,没有任何反应。我可以使用“添加”按钮添加该功能。本书的第 3 版要求用户使用“添加”按钮添加功能和其他三个不是功能的依赖项。但是添加功能的对话框只允许我添加功能。不存在其他匹配项,添加该功能后匹配项列表为空。
其次,虽然我的 feature.xml 包含插件,但 todo.product 文件不包含插件:
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.example.e4.rcp.todo.feature"
label="Feature"
version="1.0.0.qualifier"
provider-name="EXAMPLE">
<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>
<plugin
id="com.example.e4.rcp.todo"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
对于我可以尝试或调查什么来克服这个问题,有人有什么建议吗?
编辑---添加产品文件的内容---
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="to-do" uid="product" id="com.example.e4.rcp.todo.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" useFeatures="true" includeLaunchers="true">
<configIni use="default">
</configIni>
<launcherArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
<windowImages/>
<launcher name="todo">
<solaris/>
<win useIco="false">
<bmp/>
</win>
</launcher>
<vm>
</vm>
<plugins>
</plugins>
<features>
<feature id="com.example.e4.rcp.todo.feature"/>
</features>
<configurations>
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.p2.reconciler.dropins" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
</configurations>
<preferencesInfo>
<targetfile overwrite="false"/>
</preferencesInfo>
<cssInfo>
</cssInfo>
</product>
更新
另一个观察结果:当我启用运行配置以在启动之前自动验证插件时,我得到:
然后如果我在插件执行环境中删除 JavaSE-1.7 条目,从而使 EE 列表为空,则丢失的依赖项数量减少到:
但我还没有弄清楚如何解决这种依赖关系。产品中的“内容”选项卡不允许我添加它。我可以将它添加到插件和 todo.feature 中,但这会增加缺少的依赖项的数量。我可以尝试继续添加到插件和功能中的依赖项列表,但这似乎不是教程所建议的。我觉得我缺少一些基本的东西。
【问题讨论】:
-
“Dependencies”在 MANIFEST.MF/plugin.xml 编辑器中,而不是在 .product 编辑器中。
-
我确实在插件中看到了“依赖项”选项卡,但我在书中和在线看到的所有产品屏幕截图都在产品编辑器中放置了一个依赖项选项卡。此外,该练习要求用户添加 org.eclipse.e4.rcp、org.eclipse.emf.ecore 和 org.eclipse.emf.common。如果我尝试在 plugin.xml 编辑器中添加它们,则只有 org.eclipse.emf.ecore 成功。其他不是选项。不知道这揭示了什么。安装问题?
-
实际上我认为 .product 编辑器中的“依赖项”选项卡在某些时候被重命名为“内容”以避免混淆。如果您在 Overview 选项卡上选择了“product configuration is based on features”,则 Contents 选项卡上的 Add 应该会显示所有 Eclipse 特性。向我们展示 .product 文件的内容。
-
感谢 greg-449 的信息。我发布了产品文件的内容。
-
@RichRamos 在我看来,您必须手动创建一个新功能项目,按照教程的建议修改其中的 feature.xml,然后将新功能项目作为原始项目中的依赖项。此链接可能会有所帮助:link