Mil*_*bin 8 eclipse p2 equinox
我有一个Eclipse功能,其中包含几个包.我想告诉p2将其中一个软件包标记为在安装该功能时启动.这可以使用捆绑自己的META-INF/p2.inf这样,
instructions.configure = markStarted(started: true)
Run Code Online (Sandbox Code Playgroud)
但我想在功能级别而不是捆绑级别执行此操作(有问题的捆绑包是第三方,如果可能的话,我不希望以任何方式修改它).
一些研究让我看到了这个文档,它表明应该可以将配置指令移动到包含特征的p2.inf.我尝试过所有明显的事情,比如
units.0.id = <bundle symbolic name>
units.0.instructions.configure = \
org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started: true)
Run Code Online (Sandbox Code Playgroud)
但到目前为止,我尝试的所有排列都没有任何影响:因为没有任何反应,捆绑包没有标记为已启动且未报告任何错误).
任何指针都会非常受欢迎.使用Eclipse Equinox Galileo(3.5.2)...与Helios相关的答案也非常有用.
"单位.#." p2.inf条目创建一个新的可安装单元,它们不会修改其他现有的IU.
您基本上必须创建一个完整的Installable Unit片段.该片段具有相关说明并附加到您的捆绑包的IU.然后,您需要将功能中的要求添加到此新IU中.
PDE/Build在构建产品时自动执行此操作.您可以通过创建一个具有捆绑包起始级别的小型rcp产品构建来查看生成的p2.inf.
产品构建中生成的p2.inf将是buildDirectory/features/org.eclipse.pde.build.container.feature/product/p2.inf
这是我从构建中修改的示例,该构建设置了起始级别org.eclipse.equinox.common.在$version$将得到由该p2.inf属于功能的版本取代.注意"hostRequirements",它指定了我们是其片段的包.
#create a requirement on the IU fragment we are creating
requires.2.namespace=org.eclipse.equinox.p2.iu
requires.2.name=configure.org.eclipse.equinox.common
requires.2.range=[$version$,$version$]
requires.2.greedy=true
#create a IU frament named configure.org.eclipse.equinox.common
units.0.id=configure.org.eclipse.equinox.common
units.0.version=$version$
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=configure.org.eclipse.equinox.common
units.0.provides.1.version=$version$
units.0.instructions.install=installBundle(bundle:${artifact});
units.0.instructions.uninstall=uninstallBundle(bundle:${artifact});
units.0.instructions.unconfigure=setStartLevel(startLevel:-1);markStarted(started:false);
units.0.instructions.configure=setStartLevel(startLevel:2);markStarted(started:true);
units.0.hostRequirements.1.namespace=osgi.bundle
units.0.hostRequirements.1.name=org.eclipse.equinox.common
units.0.hostRequirements.1.range=[3.6.0.v20100503,3.6.0.v20100503]
units.0.hostRequirements.1.greedy=false
units.0.hostRequirements.2.namespace=org.eclipse.equinox.p2.eclipse.type
units.0.hostRequirements.2.name=bundle
units.0.hostRequirements.2.range=[1.0.0,2.0.0)
units.0.hostRequirements.2.greedy=false
units.0.requires.1.namespace=osgi.bundle
units.0.requires.1.name=org.eclipse.equinox.common
units.0.requires.1.range=[3.6.0.v20100503,3.6.0.v20100503]
units.0.requires.1.greedy=false
Run Code Online (Sandbox Code Playgroud)
问题的答案:
0,1,2
这些数字是有点武断,它们的作用只是一组特性(单独requires或units与另一个或其他).在requires这里使用一个"2",只是因为我复制它从由pde.build产生和忘记去改变它像我一样的units.0大p2.inf.
这一切都是必要的吗?
是.需要第二个hostRequirements类型= bundle.在Helios中,除了翻译片段之外,只有一个片段可以附加到IU.通常,默认IU可用于设置所有osgi包的默认启动级别.为了使我们的自定义片段在默认片段上被选择,它必须具有更高的"特异性",这是满足主机要求的数量.
用于"安装"
units.0.instructions.install = installBundle(束:$ {工件}); units.0.instructions.uninstall = uninstallBundle(束:$ {工件});
该instructions.install和instructions.uninstall指P2方法的阶段.该installBundle和uninstallBundle指在OSGi意义上的安装/卸载.必须先将捆绑包安装到OSGi系统中,然后才能执行其他操作.这基本上是invovles将它添加到config.ini或org.eclipse.equinox.simpleconfigurator/bundles.info文件中.
大多数p2安装已经包含一个默认配置IU,它将安装并设置bundle的默认启动级别(4).但是,目前只有一个配置片段可以应用于每个捆绑包,因此当您添加自己的捆绑包时,默认设置不再应用于捆绑包.
hostRequirements.可安装的单元片段页面只描述片段的内容,而没有关于如何创建片段的参考.它在" 自定义元数据"页面上被提到,但没有解释.
文档,在p2类别下维基上有很多东西.接触点说明页面可能很有趣.help.eclipse.org上有一些帮助,但总的来说,我认为这有一些更高级的文档.
| 归档时间: |
|
| 查看次数: |
1624 次 |
| 最近记录: |