用单个类修补插件? [英] Patch a plugin with a single class?

查看:23
本文介绍了用单个类修补插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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.

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

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

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.

推荐答案

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

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. 创建一个插件来封装你的单个类文件
  2. 创建一个功能补丁,其中包含您的新插件并修补您的目标功能.
  3. 导出您的功能补丁并创建 p2 元数据(以创建更新站点).
  4. 使用安装管理器安装到您的 Eclipse 中
  5. 高兴!

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

(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

更多信息:

http://aniefer.blogspot.com/2009/06/patching-features-with-p2.htmlhttp://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.

这篇关于用单个类修补插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆