How to create an Eclipse RCP application so that its functions can be automatically updated?

I am creating an RCP application that will consist of several functions.

The RCP application is configured to check for updates every time it starts. My current problem is that I need one of my features to be β€œInstalled” during the build so that it updates during this automatic update check without forcing the user to manually install it. I need this function to update independently of other functions in the system.

So, to repeat, I'm just looking for a convenient automated way to install Feature in an RCP application so that it is updated independently of other functions and does not require the user to use the RCP application to install it manually.

+6
source share
3 answers

Meanwhile, Tycho has explicit support for this use case. Starting with Tycho 0.20.0 , you can make Tycho to install RCP components separately from the product. Thus, these functions can be updated (or even removed) regardless of the product.

To install functions yourself, simply add the installMode="root" attribute to the corresponding function tags in the product file. Example:

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

See this documentation page for more information.

+2
source

After a long search, I found the answer. This is a kind of kludge, but I'm ready to do something at this point. My decision depends on the fact that my embedded RCP application includes the application p2 org.eclipse.equinox.p2.director. I think if your RCP application does not contain this application, you can refer to another Eclipse installation to start Director. I just did it in such a way as not to have an Eclipse instance sitting on my build machine.

I used the p2-dev mailing list and Paul Webster answered my question. (Thanks Paul)

He suggested using ant to run the p2 Director application to install IU in my embedded RCP application.

Here is his answer to the p2-dev mailing list http://dev.eclipse.org/mhonarc/lists/p2-dev/msg04735.html

Here I came up with ant target.

 <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> 

I put this in the ant file in the same project that creates my RCP Eclipse application through Tycho. Tycho produces my build artifacts in a directory called "target", so my parameters for the ant target above look like this:

 <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> 

I have a few more of these goals for each platform for which my RCP application is created.

Hope this helps.

UPDATE: May 8, 2014. Tobias drew my attention to the fact that I have to change the accepted answer from this to one that has a new function added in Tycho 0.20.0, which allows this behavior to a large extent in a simpler way. So, the new accepted answer is the right solution for this question.

+5
source

Before I found the answer that is described here and accepted, I tried and could not solve this problem in the following ways:

I tried to put a function in the product definition. This will install this feature successfully, but it removes my ability to update it independently of the other features of the RCP application.

I have a p2 touchpoint command that currently works. It adds the repository to the available update sites in the RCP application using the p2.inf file. It looks like this...

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

I tried adding a line like this to install this function, but my tycho command does not work when I run mvn clean install

 instructions.configure=\ org.eclipse.equinox.p2.touchpoint.eclipse.installFeature(feature:My Feature Name,featureId:com.my.domain.my.feature.id,version:1.0.0); 

Here is some error message from 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. 

My intuition tells me that this error message says that my RCP application plugin is missing what p2 will tell where to find the function that I want to install during the build. I think???

+1
source

Source: https://habr.com/ru/post/914341/


All Articles