Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何构建EclipseRCP应用程序,以便其功能可以自动更新?_Eclipse_Eclipse Plugin_Eclipse Rcp_P2_Tycho - Fatal编程技术网

如何构建EclipseRCP应用程序,以便其功能可以自动更新?

如何构建EclipseRCP应用程序,以便其功能可以自动更新?,eclipse,eclipse-plugin,eclipse-rcp,p2,tycho,Eclipse,Eclipse Plugin,Eclipse Rcp,P2,Tycho,我正在构建一个RCP应用程序,它将由几个功能组成 我的RCP应用程序配置为在每次启动时检查更新。我当前的问题是,我需要在构建时“安装”我的一个功能,以便在自动检查更新时更新它,而不强制用户手动安装它。我需要此功能独立于系统中的其他功能进行更新 所以,总而言之,我只是在寻找一种很好的自动方式,在RCP应用程序中安装一个功能,使其独立于其他功能进行更新,而不需要RCP应用程序的用户手动安装。经过长时间的搜索,我找到了答案。这有点困难,但我愿意在这一点上做任何事。我的解决方案取决于我构建的RCP应用程

我正在构建一个RCP应用程序,它将由几个功能组成

我的RCP应用程序配置为在每次启动时检查更新。我当前的问题是,我需要在构建时“安装”我的一个功能,以便在自动检查更新时更新它,而不强制用户手动安装它。我需要此功能独立于系统中的其他功能进行更新


所以,总而言之,我只是在寻找一种很好的自动方式,在RCP应用程序中安装一个功能,使其独立于其他功能进行更新,而不需要RCP应用程序的用户手动安装。

经过长时间的搜索,我找到了答案。这有点困难,但我愿意在这一点上做任何事。我的解决方案取决于我构建的RCP应用程序包括p2应用程序org.eclipse.equinox.p2.director这一事实。我想如果您的RCP应用程序不包含此应用程序,您可以参考另一个Eclipse安装来启动Director。我这样做只是为了避免Eclipse实例出现在我的构建机器上

我使用p2-dev邮件列表,Paul Webster回答了我的问题。(谢谢保罗)

他建议使用ant启动p2控制器应用程序,将IU安装到我构建的RCP应用程序中

这是他在p2-dev邮件列表上的答案

这是我找到的蚂蚁目标

<target name="install_IU">
  <path id="launcher.paths">
    <fileset
       dir="${app.dir}"
       includes="plugins/org.eclipse.equinox.launcher_*" />
  </path>
  <property
      name="launcherPath"
      refid="launcher.paths" />
  <echo>-installIU ${iu.id} </echo>
  <java 
      jar="${launcherPath}"
      failonerror="false"
      dir="${app.dir}"
      timeout="900000"
      fork="true"
      output="${basedir}/director.log"
      resultproperty="directorcode">
      <arg line="-application org.eclipse.equinox.p2.director" />
      <arg line="-noSplash" />
      <arg line="-installIUs ${iu.id}" />
      <arg line="-repository ${iu.repo}" />
      <arg line="-destination ${app.dir}" />
      <arg line="-bundlepool ${app.dir}" />
  </java>

  <zip destfile="${app.zip}"
    basedir="${app.dir}"/>
</target>

-installIU${iu.id}
我将其放在ant文件中,该文件与通过Tycho生成Eclipse RCP应用程序的项目相同。Tycho在一个名为“target”的目录中生成了我的构建工件,因此上面ant目标的参数如下所示

<target name="modify_x86">
  <antcall target="install_IU">
    <param name="iu.id" value="com.mydomain.the.feature.i.want.to.install.feature.feature.group"/>
    <param name="iu.repo" value="http://mydomain.com/thep2repository/where/i/deploy/the/feature/to/install"/>
    <param name="app.dir" value="${basedir}/target/products/com.mydomain.myRCPapplication/win32/win32/x86"/>
    <param name="app.zip" value="${basedir}/target/products/com.mydomain.myRCPapplication-win32.win32.x86.zip"/>
  </antcall>
</target>
instructions.configure=\
 org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//myUpdateSsite/myFeature,type:0,name:My Feature Name,enabled:true);\
 org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//myUpdateSsite/myFeature,type:1,name:My Feature Name,enabled:true);\\

对于我的RCP应用程序构建的每个平台,我还有几个目标

希望这有帮助


更新:2014年5月8日。Tobias提醒我,我应该将已接受的答案从这一个更改为一个具有添加到Tycho 0.20.0中的新功能的答案,该功能以更简单的方式支持此行为。因此,新的被接受的答案现在是这个问题的正确解决方案。

与此同时,Tycho明确支持这个用例。首先,您可以让Tycho将RCP的功能与产品分开安装。通过这种方式,这些功能可以独立于产品进行更新(甚至卸载)

要独立安装功能,只需将属性
installMode=“root”
添加到产品文件中相应的功能标签中。例如:

<features>
   <feature id="org.eclipse.platform"/>
   <feature id="updatable.feature" installMode="root"/>
</features>


有关更多信息,请参阅。

在我找到此处记录并被接受的答案之前,我尝试用以下方法解决此问题,但失败了:

我试着在产品定义中加入这个特性。这是成功安装的功能,但它剥夺了我独立于RCP应用程序中的其他功能进行更新的能力

我有一个p2接触点命令,目前正在工作。它使用p2.inf文件将存储库添加到RCP应用程序中的可用更新站点。看起来像这样

<target name="modify_x86">
  <antcall target="install_IU">
    <param name="iu.id" value="com.mydomain.the.feature.i.want.to.install.feature.feature.group"/>
    <param name="iu.repo" value="http://mydomain.com/thep2repository/where/i/deploy/the/feature/to/install"/>
    <param name="app.dir" value="${basedir}/target/products/com.mydomain.myRCPapplication/win32/win32/x86"/>
    <param name="app.zip" value="${basedir}/target/products/com.mydomain.myRCPapplication-win32.win32.x86.zip"/>
  </antcall>
</target>
instructions.configure=\
 org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//myUpdateSsite/myFeature,type:0,name:My Feature Name,enabled:true);\
 org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//myUpdateSsite/myFeature,type:1,name:My Feature Name,enabled:true);\\
我试图添加这样一行代码来安装该功能,但当我运行mvn clean install时,我的tycho构建失败了

instructions.configure=\
 org.eclipse.equinox.p2.touchpoint.eclipse.installFeature(feature:My Feature Name,featureId:com.my.domain.my.feature.id,version:1.0.0);
下面是来自maven/tycho的一些错误消息

An error occurred while configuring the installed items session context was:
(profile=DefaultProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Configure, operand=null --> 
[R]{my.domain.my.rcp.product.plugin 1.1.6.20120427-1346}, 
action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallFeatureAction).
Installable unit contains no artifacts: [R]my.domain.my.rcp.product.plugin 1.1.6.20120427-1346.

我的直觉告诉我,这个错误消息是说我的RCP应用程序插件缺少一些东西,这些东西将告诉p2在构建时在哪里找到我想要安装的功能。我想???

努力吧!但是,
installFeature
接触点在这里无法工作。接触点是p2的物理(即文件i/O)层。您需要更改安装的高级p2元数据以实现您的目标。我同意上面的示例不起作用。我把它们放在这里,这样其他人就可以在网络搜索中找到同样的东西。我真的很想了解更多关于p2在这里所做的事情。很难弄清楚如何使用p2,因为IMHO不是很直观。我真的想了解更多。。。那么,“您需要更改安装的高级p2元数据”是什么意思?哦,保罗·韦伯斯特给我的答案对我有用,因此,我最近没有寻求其他可能的解决方案。在评论中添加了更多的解释。仅供参考,这就是为什么这样做的原因:First Tycho内部调用(嵌入式)p2控制器并安装产品IU。然后,再次呼叫控制器并安装功能IU。然后,生成的安装有两个“根IU”(即安装范围的入口点)。检查更新将检查每个根IUs是否有更新的版本-因此,当配置的存储库中有更新的版本可用时,您的功能将得到更新。我有个好消息:Tycho现在有了,因此您可能可以摆脱大约一英里的pom.xml配置;-)谢谢,我已经从上面删除了旧的ant代码,并利用了新功能。我是这个bug的18位投票者之一:)在这种情况下,您可能应该将接受的答案更改为。我在哪里可以找到这个.product文件?