【问题标题】:A working example of custom p2 provisioning action自定义 p2 配置操作的工作示例
【发布时间】:2013-05-24 02:05:23
【问题描述】:

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

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

谢谢。

【问题讨论】:

    标签: eclipse p2


    【解决方案1】:

    终于,我终于搞定了:

    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>
    

    META-INF\p2.xml

    provides.0.namespace=com.company.example.plugin
    provides.0.name=do_custom_action
    provides.0.version=1.0
    

    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>
    

    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();
    

    一般cmets:

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

    【讨论】:

    • META_INF\p2.xml 应该是 META_INF\p2.inf
    【解决方案2】:

    如果你想让你的接触点动作起作用,有两种方法,

    1. 首先安装提供新接触点操作的插件。然后使用新的接触点操作安装存储库中的内容。
    2. iu 取决于新的接触点操作需要,需要捆绑提供新的接触点操作,它与您找到的完全一样。请参阅 Simon Kaegi 附加的example code

    【讨论】:

    • 塔克斯凯恩!您知道是否有一种方法可以在调用之前自动下载带有自定义接触点的插件?示例代码呢,我无法让它工作——bundle2 不会自动下载。
    猜你喜欢
    • 1970-01-01
    • 2015-03-20
    • 1970-01-01
    • 2016-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-21
    相关资源
    最近更新 更多