经过长时间的搜索,我找到了答案。这有点杂乱,但此时我愿意做任何事情。我的解决方案取决于我构建的 RCP 应用程序包含 p2 应用程序 org.eclipse.equinox.p2.director。我想如果您的 RCP 应用程序不包含此应用程序,您可以参考另一个 Eclipse 安装来启动 Director。我这样做只是为了避免 Eclipse 实例位于我的构建机器上。
我使用了 p2-dev 邮件列表,Paul Webster 回答了我的问题。 (谢谢保罗)
他建议使用 ant 启动 p2director 应用程序,将 IU 安装到我构建的 RCP 应用程序中。
这是他在 p2-dev 邮件列表上的回答http://dev.eclipse.org/mhonarc/lists/p2-dev/msg04735.html http://dev.eclipse.org/mhonarc/lists/p2-dev/msg04735.html
这是我想出的蚂蚁目标。
<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>
我将其放入通过 Tycho 生成 Eclipse RCP 应用程序的同一项目中的 ant 文件中。第谷在名为“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>
对于我的 RCP 应用程序构建的每个平台,我还有一些这样的目标。
希望这可以帮助。
更新:2014 年 5 月 8 日。Tobias 引起了我的注意,我应该将接受的答案从这个答案更改为具有添加到 Tycho 0.20.0 的新功能的答案,该功能以更简单的方式实现了此行为。因此,新接受的答案是现在这个问题的正确解决方案。