用单个类修补插件?

发布于 2024-12-08 11:02:25 字数 730 浏览 0 评论 0原文

这是我的情况:我们的 Eclipse 环境中有第三方功能。该功能包含多个插件。该插件包含一堆类。其中一个类包含一个错误。

我们已经能够找到该错误的解决方案,因此我们有一个包含该错误的类的工作版本。

不幸的是,这个插件包含在 55 页长的 EULA(IBM 提供)中,所以我认为可以很安全地假设反编译 jar、交换类文件、重新编译和分发在法律上是不可能的。我不是法律专家,但我想我们不能以任何方式篡改 jar 文件。

所以这意味着我想要加载一个类文件而不是插件中的类,这可能吗?

这个 页面 建议使用片段,但这需要修改插件中的清单。

这个 问题 与我有同样的问题,但在这种情况下可以访问到源代码,他能够构建一个插件。

这篇博文展示了如何使用功能补丁,但它们要求我能够构建自己的插件,但我不能,因为我只有一个类。

This is my situation: We have a third party feature in our Eclipse environment. The feature contains several plugins. The plugin contains a bunch of classes. One of the classes contains a bug.

We have been able to find a solution to the bug, so we have a working version of the class with the bug.

Unfortunately this plugin is covered by a 55 page long EULA (by IBM) so I think it's pretty safe to assume that decompiling the jar, exchanging class files, recompiling and distribute is legally out of the question. I'm no legal expert, but I'd guess we cannot tamper with the jar files in any way.

So this means I have a single class file that I want to be loaded instead of a class in a plugin, is this at all possible?

This page suggests using fragments, but this requires modifying the manifest in the plugin.

This question has the same problem as me, but in that case there is access to the source code and he is able to build a plugin.

This blogpost shows how use feature patches, but they require that I'm able to build my own plugin, which I cant since I have just the one class.

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

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

发布评论

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

评论(2

打小就很酷 2024-12-15 11:02:25

我不会尝试使用片段。根据我的经验,最干净的做法是使用功能补丁。我已经成功地使用功能补丁来完成您想要做的事情。它并不简单,但很坚固。您需要执行以下操作。

  1. 创建一个封装单个类文件的插件
  2. 创建一个功能补丁,其中包含您的新插件并修补您所针对的功能。
  3. 导出功能补丁并创建 p2 元数据(以创建更新站点)。
  4. 使用安装管理器安装到您的 Eclipse
  5. 高兴!

  6. (可选)默认情况下,功能补丁仅针对目标功能的单个版本。因此,如果目标功能提高其版本号,则功能补丁将不再适用。不过,可以放宽功能补丁的版本限制。此过程详细描述如下:http://aniefer.blogspot .com/2009/06/patching-features-part-2.html

更多信息:

http://aniefer.blogspot.com/2009/06/patching-features -with-p2.html
http://aniefer.blogspot.com/2009/06/patching -features-part-2.html

使用功能补丁而不是片段的好处是任何人都可以安装补丁并使补丁正常工作,但是使用片段会更困难,因为最终用户必须处理体现出来。

I would not try using a fragment. In my experience, the cleanest thing to do would be to use a feature patch. I have successfully used feature patches to do exactly what you are looking to do. It's not simple, but it is robust. You need to do the following.

  1. create a plugin that encapsulates your single class file
  2. create a feature patch that includes your new plugin and that patches the feature that you are targeting.
  3. export your feature patch and create the p2 metadata (to create an update site).
  4. Install into your Eclipse using the install manager
  5. Rejoice!

  6. (optional) Feature patches by default only target a single version of the target feature. So, if the target feature bumps up its version number, the feature patch will silently no longer be applied. However, it is possible to relax the version constraints on the feature patch. This process is described in detail here: http://aniefer.blogspot.com/2009/06/patching-features-part-2.html

More information:

http://aniefer.blogspot.com/2009/06/patching-features-with-p2.html
http://aniefer.blogspot.com/2009/06/patching-features-part-2.html

The benefit of using a feature patch over a fragment is that anyone can install the patch and get the patch working, but things are more difficult with a fragment in that end users must muck with manifests.

慢慢从新开始 2024-12-15 11:02:25

所以这意味着我想要加载一个类文件而不是插件中的类,这可能吗?

你的第一句话就是答案。您可以使用片段,但这需要修改插件中的清单。否则,Eclipse 将不知道要加载哪个类。

我的建议是您将所有这些信息(包括补丁)写给 IBM。 IBM 应该能够发布一个维护修复程序来解决您的问题。

同时,您可以选择片段选项,这需要您解压 jar、添加片段、修改清单并重新打包 jar。这是否合法超出了我的能力范围。

So this means I have a single class file that I want to be loaded instead of a class in a plugin, is this at all possible?

Your first sentence is the answer. You can use a fragment, but that requires modifying the manifest in the plugin. Otherwise, Eclipse would have no idea which class to load.

My suggestion is that you write IBM with all of this information, including the patch. IBM should be able to release a maintenance fix which would solve your problem.

In the mean time, you could pursue the fragment option, which would require you to unpack the jar, add your fragment, modify the manifest, and repackage the jar. Whether or not this is legal is beyond my ability to determine.

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