自定义p2配置操作的工作示例

Nik*_*pov 9 eclipse p2

我正在尝试编写自定义p2配置操作以在安装功能时执行我自己的代码.使用installHandler for Update Manager这样做很容易,但对于p2,在网络上绝对没有关于这个主题的文档,大多数时候eclispe只是默默地忽略了我(即使在日志中),也是我发现的唯一例子不管用.

所以,如果有人可以指出我自定义配置操作的一个工作示例,那将有助于我理解整个事情.

谢谢.

Nik*_*pov 10

最后,我让它以某种方式工作:

example_plugin:

plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.5"?>
<plugin>
  <extension point="org.eclipse.equinox.p2.engine.touchpoints" id="example" name="Eclipse Touchpoint">
    <touchpoint type="com.company.example.plugin" class="org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint" version="1.0"/>
  </extension>

  <extension point="org.eclipse.equinox.p2.engine.actions">
    <action
      class="com.company.example.plugin.CustomAction"
      name="do_custom_action"
      touchpointType="com.company.example.plugin"
      touchpointVersion="1.0"          
      version="1.0">
    </action>
  </extension>
</plugin>
Run Code Online (Sandbox Code Playgroud)

META-INF\p2.xml:

provides.0.namespace=com.company.example.plugin
provides.0.name=do_custom_action
provides.0.version=1.0
Run Code Online (Sandbox Code Playgroud)

example_feature:

feature.xml:

<?xml version="1.0" encoding="UTF-8"?>
<feature id="com.company.example.feature" label="Maven installer feature" version="2.2.1.qualifier">
  <description url="http://www.example.com/description">[Enter Feature Description here.]</description>
  <copyright url="http://www.example.com/copyright">[Enter Copyright Description here.]</copyright>
  <license url="http://www.example.com/license">[Enter License Description here.]</license>

 <requires>
   <import plugin="com.company.example.plugin"/>
 </requires>

 <plugin
   id="com.company.example.plugin"
   download-size="0"
   install-size="0"
   version="0.0.0"
   unpack="false"/>
</feature>
Run Code Online (Sandbox Code Playgroud)

p2.inf:

metaRequirements.0.namespace=com.company.example.plugin
metaRequirements.0.name=do_custom_action
metaRequirements.0.range=1.0

instructions.configure = com.company.example.plugin.do_custom_action();
Run Code Online (Sandbox Code Playgroud)

普通的留言:

  • 自定义接触点操作作为常规类存储在插件中.
  • 更新站点必须包含正确的artifacts.jar/content.jar(不知道为什么,花了很多时间来调试这个).