Pages

Showing posts with label plug-in. Show all posts
Showing posts with label plug-in. Show all posts

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.
/* */