3

我正在创建一个需要 jdt.ui.JavaUI 类的插件。我将 jdt.ui 插件包含在依赖项中。这是我的 Manifest.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PanelGenerator Plug-in
Bundle-SymbolicName: PanelGeneratorPlugin; singleton:=true
Bundle-Version: 0.1.0
Bundle-Activator: panelgenerator.plugin.Activator
Require-Bundle: org.eclipse.jdt.core,
 org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.core.resources,
 org.eclipse.ui.ide,
 org.eclipse.jdt.ui
Eclipse-LazyStart: true

这是我的 build.properties:

source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
           META-INF/,\
           .,\
           icons/,\
           templates/

在编译时,我没有收到任何编译错误。如果我使用 Eclipse(调试为 -> Eclipse 应用程序)调试插件,它工作正常。

但是,当我将其导出,然后将其复制到 Eclipse 插件文件夹中时,该插件不起作用。只要使用 JavaUI 类,什么都不会发生。错误日志报告了这一点:

java.lang.NoClassDefFoundError: org/eclipse/jdt/ui/JavaUI

关于为什么会发生这种情况的任何想法?

4

4 回答 4

2

“Require-Bundle”中插件的顺序很重要!您应该按照最基本的顺序排列它们。

我会建议:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PanelGenerator Plug-in
Bundle-SymbolicName: PanelGeneratorPlugin; singleton:=true
Bundle-Version: 0.1.0
Bundle-Activator: panelgenerator.plugin.Activator
Require-Bundle:  org.eclipse.core.runtime,
 org.eclipse.core.resources,
 org.eclipse.jdt.core,
 org.eclipse.ui,
 org.eclipse.ui.ide,
 org.eclipse.jdt.ui
Eclipse-LazyStart: true

这是因为 eclipse 按照您提供的顺序从包中加载类。如果订单不是从“基本”到“非基本”,这可能会导致麻烦。试试这个,它可能会有所帮助。

于 2009-11-14T17:15:36.623 回答
0

是的,如果您将插件导出到 jar 中并将其复制到eclipse 安装的插件文件夹中,则某些依赖项将不起作用(包括 org.eclipse.jdt.ui)。事实上,我相信只有 org.eclipse.core 中的包才能正常工作,如果你像这样分发你的插件。

要实际安装插件,您需要执行以下操作之一:

  1. 将导出的 jar 复制到dropins(不是插件)文件夹中。插件将在您下次启动 eclipse 时安装。
  2. 导出并安装到正在运行的主机中
  3. 创建一个功能项目、一个更新站点并通过安装新软件选项菜单安装您的插件。
于 2013-11-04T11:48:25.597 回答
0

Which version of Eclipse are you trying this with? If you are using 3.4 (Ganymede) or 3.5 (Galileo), you can't just add new plugins to the plugins folder anymore. Try putting your plugin into the dropins folder instead (that is the intention of the dropins folder).

When your plugin is ready for a more permanent deployment, you can export it with P2 metadata and use the update manager to start it up.

If you're using an older version of Eclipse, the .log file will probably give you some details about the plugin.

于 2009-12-19T00:55:39.977 回答
0

我唯一能想到的可能是您正在针对不同的版本进行编译,而不是针对您运行的版本,并且存在非二进制兼容的更改。您可以在发生这种情况的eclipse bug 177476中看到类似的内容。

于 2009-10-02T20:03:24.093 回答