Pages

Wednesday, February 15, 2012

Eclipse RCP P2 self-update


I have been working last time in order to add update mechanism to Eclipse RCP application we have developed in my team. I must confess I struggled for some time with the P2 mechanism and finally I succeeded to obtain the expected result: an RCP based application with an automatic self-update mechanism, using headless build and testable with Jenkins.


Adding self-update to an application is not a ordinary or easy task. There are few examples here, here, or here
I tried different solution and there were always some scenarios that didn’t work properly (headless build did not work as expected,  problems with dependencies in eclipse.equinox.p2.user.ui, plug-in org.eclipse.equinox.ds not started and the most frustrating the updates were not detected). Therefore, my colleagues agreed all that P2 mechanism is "unnecessary complicated".  


Here are steps that I followed in order to have the provisioning mechanism working.
  • Create a feature-based product (a simple RCP Application to which we will add features)
  •  Export the product
  •  Export features to be included in the application
  • Install features to the result application. You may add them manually using the Install New Software menu or use a command line or script. For instance you may use:

%eclipse_home%/eclipsec.exe -application org.eclipse.equinox.p2.director -repository <list_of_comma_separated_repositories>  -installIU <your_feature_group> -destination <location_of_targeted_product>  -profile <profile>
  • Modify your bundles and features version number
  • Export again the features and deploy them optionally on a web server
  • Start your application and check for updates (update sites may be added at he runtime, in the code or using p2.inf file to have pre-defined locations): it should detect the updated features. Additionally, I added headless update at startup as described here

I hope this will help you to have your P2 working. I will publish soon the source code and scripts for this application.

5 comments:

  1. Hi, I use this method to add update mechanism to my RCP application. Is there any way to export deployables features not using the IDE wizards?

    ReplyDelete
    Replies
    1. Hello,
      I am using for a while Maven Tycho, project hosted now at Eclipse (http://www.eclipse.org/tycho/). Tycho propose for instance a packaging that creates a p2 repository (http://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-repository).
      One the oter hand you may use headless build (http://help.eclipse.org/indigo/topic/org.eclipse.pde.doc.user/tasks/pde_p2_integration.htm) either in a terminal, either using ant.
      Regards,

      Delete
  2. I need to add Check for Updates and Install new softfare options in Help menu.I followed
    http://www.subshell.com/en/subshell/blog/article-equinox-p2-in-your-own-RCP-Application100.html

    when I click on the exe the RCP UI comes up with the meues Check for Updates and Install new softfare
    but when I click on them , I get the error pop up " cannot complete the request. this installation has
    not been configured properly for software update. see the error log for details"


    and in the ../workspace/.metadata/.log file gives the log


    !ENTRY org.eclipse.equinox.p2.ui.sdk 2 0 2012-07-25 18:22:13.983
    !MESSAGE Could not locate the running profile instance. The eclipse.p2.data.area and eclipse.p2.profile properties may not be set correctly in this application's config.ini file.

    Any help appreciated


    Thanks
    Ambika

    ReplyDelete

/* */