Patch a plugin with a single class?

后端 未结 2 1943
生来不讨喜
生来不讨喜 2021-01-12 16:02

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 clas

相关标签:
2条回答
  • 2021-01-12 16:27

    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.

    0 讨论(0)
  • 2021-01-12 16:32

    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.

    0 讨论(0)
提交回复
热议问题