简体   繁体   English

如何将Eclipse RCP插件JAR转换为插件目录,反之亦然?

[英]How to convert Eclipse RCP plugin JAR to a plugin directory and vice versa?

What I have is an RCP application, and a plugin directory in it: 我所拥有的是一个RCP应用程序,以及其中的一个插件目录:

my-rcp-app/
  ...
  plugins/
    ...
    com.mycompany.myproduct.ui_1.0.1/
      com/
      META-INF/
      plugin.xml

Then I make a JAR with the same contents as the plugin directory, com.mycompany.myproduct.ui_1.0.1.jar , and put it into plugins/ instead of a com.mycompany.myproduct.ui_1.0.1 folder. 然后,我制作一个与插件目录com.mycompany.myproduct.ui_1.0.1.jar相同的JAR,并将其放入plugins/而不是com.mycompany.myproduct.ui_1.0.1文件夹。

Surprisingly, the app doesn't start. 令人惊讶的是,该应用程序无法启动。 That's from the logs: 那是从日志:

 !SUBENTRY 2 com.mycompany.root.bundle 2 0 2012-07-05 20:01:17.511
 !MESSAGE Missing required bundle com.mycompany.myproduct.ui_1.0.1.

So, 2 questions here: 因此,这里有两个问题:

  1. How to deploy a plugin in a JAR, if I've got a directory with classes, configs etc. 如果我有包含类,配置等的目录,如何在JAR中部署插件。
  2. Is it enough to unpack a JAR into plugins, for the app to keep working? 将JAR打包到插件中是否足以使应用程序继续工作?
  1. From the main page of the Manifest Editor you can open an export wizard. 在清单编辑器的主页上,您可以打开一个导出向导。 It will create a jar file containing your plug-in. 它将创建一个包含您的插件的jar文件。 If you want to specify which files should be exported, then go to the build tab in the Manifest Editor. 如果要指定应导出的文件,请转到清单编辑器中的“构建”选项卡。

  2. It should not matter if your plug-in is unpacked or in a Jar File. 插件是否已解压缩或在Jar文件中都没关系。 Equinox is able to handle both cases. Equinox能够处理这两种情况。 Note that is recommended to use the dropins folder instead of the plugins folder, if you don't want to manage plug-ins via the Eclipse Update Site mechanism. 请注意,如果您不想通过Eclipse Update Site机制来管理插件,建议使用dropins文件夹而不是plugins文件夹。

As @TobiasWillig already noted, plug-in directories and JARs are indeed fully interchangeable. 正如@TobiasWillig所指出的,插件目录和JAR确实可以完全互换。

But in this specific case I had to edit configuration/org.eclipse.equinox.simpleconfigurator/bundles.info file, replacing 但是在这种特定情况下,我必须编辑configuration/org.eclipse.equinox.simpleconfigurator/bundles.info文件,替换

com.mycompany.myproduct.ui,1.0.1,plugins/com.mycompany.myproduct.ui_1.0.1/,4,false

with the

com.mycompany.myproduct.ui,1.0.1,plugins/com.mycompany.myproduct.ui_1.0.1.jar,4,false

Ie, it's required to manually specify a path to the plug-in. 即,需要手动指定插件的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM