从 Eclipse 中以编程方式安装 Eclipse 插件?

发布于 2024-08-06 11:46:47 字数 593 浏览 4 评论 0原文

我想为 Eclipse 插件创建一个自动安装程序(即不通过“更新管理器”)。我的场景很简单:用户关闭 Eclipse,将下载的 JAR 放入 dropins 文件夹中,启动 Eclipse,其余过程将自动完成。

在 P2 时代之前的较旧 Eclipse 版本中,Eclipse 有(仍然有)一个名为 InstallCommand 的类,可用于将插件安装到当前运行的平台中。

虽然这在 Eclipse 3.4 和 Eclipse 中仍然有效。 3.5,它的行为不正常:最明显的是,以这种方式安装的插件无法自动卸载(它呈灰色)。

JavaDoc 声称 InstallCommand 已被弃用,应由 P2 替代方案取代。但是,我找不到适合这项工作的工具。有 P2director,但它是为从命令行作为单独的应用程序运行而构建的。可以从 Eclipse 内部调用它,但实际上并不适合这样做。例如,进度监控和错误报告效果不佳。

有人知道有一个好的替代方案吗?

谢谢, 兹维基

I want to create an automated installer for an Eclipse plugin (i.e. not through the "Update Manager"). My scenario is simple: the user closes Eclipse, drops a downloaded JAR into the dropins folder, starts Eclipse and the rest of the process is automated.

In older Eclipse versions, before the era of P2, Eclipse had (still has) a class called InstallCommand which could be used to install pluings into the currently running platform.

While this still works in Eclipse 3.4 & 3.5, it is not behaving properly: most noticeably, plugins installed that way cannot be automatically uninstalled (it is dimmed).

The JavaDoc claims the InstallCommand is deprecated and should be replaced by a P2 alternative. However, I couldn't find the right tool for the job. There is the P2 director, but it is built for running as a separate application from the command line. It is possible to invoke it from within Eclipse but it is really not cut out for that. For example, progress monitoring and error reporting are not working well.

Does anybody know of a good alternative for that?

Thanks,
Zviki

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多情出卖 2024-08-13 11:46:47

Dropins 似乎非常接近您想要的,特别是如果它们只是下载没有关联元数据的 jar(即元数据需要自动生成)。

您可以考虑定义第二个 dropins 区域来管理您自己。查看 org.eclipse.equinox.p2.reconciler.dropins 中的 ProfileSynchronizer,特别是 createProfileChangeRequest 方法。我预计您不喜欢的卸载行为是添加 IInstallableUnit.PROP_PROFILE_LOCKED_IU 属性的结果。

dropins 在启动时进行协调,请参阅 p2.reconciler.dropins Activator.watchDropins(),您可以从自己的包中执行相同的操作来观看另一个文件夹。

Dropins seems very close to what you want, especially if they are just downloading jars without the associated metadata (ie the metadata will need to be auto-generated).

You could consider defining a second dropins area to manage yourself. Take a look at ProfileSynchronizer in org.eclipse.equinox.p2.reconciler.dropins, in particular the method createProfileChangeRequest. I expect the uninstall behaviour you don't like is a result of the IInstallableUnit.PROP_PROFILE_LOCKED_IU property being added.

The dropins are reconciled at startup, see the p2.reconciler.dropins Activator.watchDropins(), you can likely do the same from your own bundle to watch another folder.

长梦不多时 2024-08-13 11:46:47

我建议将您的插件部署为可执行 JAR。 JAR 中的安装程序应该询问 Eclipse 安装目录并将插件解压到正确的位置(根据需要加上更多检查)。

可以选择包含一个小的“看门狗”插件,它并不依赖太多,只是检查您的主插件是否正确加载并显示有用的错误消息,用户可以通过电子邮件发送给您以获取支持。

I suggest to deploy your plugin as an executable JAR. The installer in the JAR should ask for the Eclipse install directory and unpack the plugin in the right place (plus some more checks as needed).

Optionally include a little "watchdog" plugin which doesn't depend on much and just checks that your main plugin loads correctly and displays a useful error message which the user can email to you for support.

墨落成白 2024-08-13 11:46:47

根据错误 311590 1 中的信息,该信息在弃用注释中引用InstallCommand 的替代方案可能是使用 P2 操作 23

According to information in bug 311590 1 which is referenced in the deprecation comment of InstallCommand an alternative is possibly to use P2 operations 2, 3.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文