Eclipse-RegisterBuddy 说明

   是这样的,我们现在的项目是基于Eclipse RCP框架的,使用Spring和Hibernate,因为Spring和Hibernate中的jar包并不是以Eclipse插件的方式发布的,所以我们就新建了一个项目,比如com.**.springframework.eclipse,把用到的Spring Jar文件放入到项目中的lib文件夹,然后将lib文件加加入到插件的Bundle-ClassPath,再以Eclipse插件的方式导出,我们把这个插件项目作为基础的插件,让其他插件依赖这个插件来使用Spring。
   我们新建了一个叫com.*.oss.client 的项目,然后在项目中新建了Spring的配置文件,放到config的源文件夹下,通过一个ServiceFactory的类使用ClassPathXmlApplicationContext方式来加载config下的配置文件,但是在加载的过程通过中出现了Spring的配置文件找不到的情况,起初还以为是配的类路径有问题,在请教了高手之后原来要在com.*.oss.client项目中的MANIFEST.MF文件加入这样一段代码:

Eclipse-RegisterBuddy: com.*.springframework.eclipse


这样问题就解决了,Eclipse-RegisterBuddy的作用是将com.*.springframework.eclipse这个插件加com.*.oss.client为伙伴插件,下面是Eclipse Wiki上的原话:

引用
Eclipse-RegisterBuddy
The Eclipse-RegisterBuddy header is used to declare a comma-separated list of symbolic names of bundles that this bundle should be a registered buddy to. The bundles with the specified symbolic names must use the registered buddy policy in order for this bundle to be a registered buddy.

Note that the following conditions must be met before a bundle X can become a registered buddy of another bundle Y:

The bundle Y must specify the registered buddy policy (i.e. Eclipse-BuddyPolicy: registered)
The bundle X must specify the symbolic name of Y in the Eclipse-RegisterBuddy header (i.e Eclipse-RegisterBuddy: Y)
The bundle X must be dependent on a package exported by bundle Y. This can happen through either a Require-Bundle or Import-Package constraint.
The syntax of the Eclipse-RegisterBuddy header is the following:

Eclipse-RegisterBuddy ::= bundle-symbolic-name ( ',' bundle-symbolic-name )*

   Eclipse-RegisterBuddy是用来声明以逗号分隔的插件的名字,该应注册为好友,使用注册好友政策,这样就可以很方便的使用伙伴插件里面的内容了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值