RCP Self Provisioning with P2: It Works!!!

I finally could create the mail demo RCP app using p2 to update itself!
My environment is Windows Vista, Java 6, Eclipse 3.4 RC4.

Here are the steps that describe how I p2-enabled the mail demo:

1. Created the mail demo (project p2-maildemo)

2. Created a product configuration p2-maildemo.product

3. Added 3 plug-ins to both launcher and product configuration (and added required plug-ins)
– org.eclipse.equinox.p2.exemplarysetup
– org.eclipse.equinox.p2.ui.sdk
– org.eclipse.equinox.simpleconfigurator.manipulator

To get the final update work in the installed product, it is also necessary to include the following 3 plug-ins with dependencies in the product configuration:
– org.eclipse.ecf.provider.filetransfer
– org.eclipse.equinox.p2.touchpoint.eclipse
– org.eclipse.equinox.p2.touchpoint.natives

4. Exported the product and the metadata/artifact repositories to c:/java/RCP/p2-maildemo

5. Used the director app to install the mail demo from the repository, with the following Program arguments:
-application org.eclipse.equinox.p2.director.app.application
-metadataRepository file:c:/java/RCP/p2-maildemo/repository
-artifactRepository file:c:/java/RCP/p2-maildemo/repository
-installIU p2_maildemo.product
-version 1.0.0
-destination c:/java/RCP/p2-maildemo/install
-profile MaildemoProfile
-bundlepool c:/java/RCP/p2-maildemo/install
-profileProperties org.eclipse.update.install.features=true
-p2.os win32
-p2.ws win32
-p2.arch x86
-roaming
-consoleLog

VM arguments:
-Declipse.p2.data.area=c:/java/RCP/p2-maildemo/install/p2

6. Started the installed mail demo in c:/java/RCP/p2-maildemo/install

7. Selected Help/Software Updates…: Showed the P2 UI with installed Product in version 1.0.0

So far so good!

Now I wanted to create a new version 1.0.1 of the product and update the installed version 1.0.0:

8. Updated main mail demo plug-in to version 1.0.1

9. Updated product version to 1.0.1

10. Exported the new product version 1.0.1 in the SAME location, to update the metadata/artifact repositories.

The first thing I noticed was that my installed 1.0.0 did not find any update. I thought, when the installation repository contains a new version, this would be seen by my application without any extra configuration.

11. So I added the repository c:/java/RCP/p2-maildemo/repository manually as a new site, and voila, the new version 1.0.1 was displayed and ready for update.

12. When I wanted to install the update, the P2 dialog told me correctly: “RCP Product is already installed, so an update will be performed instead.”

13. And now, when I clicked finish, the update was actually happening, the new version was installed properly!!!

I am so happy that I finally got this to run 🙂

What would be the best practice to create a list of artifacts/metadata repositories in the configuration/.settings/org.eclipse.equinox.p2.metadata.repository.prefs and org.eclipse.equinox.p2.artifacts.repository.prefs to include the real update sites for the product?

Many thanks to everybody who helped me.

Kai

This Post Has 21 Comments

  1. Rich Scott

    Kai,

    Congratulations. Getting to this point is not easy. I have been going down a similar path. Your post was helpful in getting the last of the director options clarified.

    Have you tried the process with an RCP application where the product is configured with features? I noticed that you have -profileProperties org.eclipse.update.install.features=true specified. I have been trying with a feature application and have gotten to the point where it installs, including features, runs, and will update. But I noticed that in the about dialog, there is no feature information available, so all of the branding information is lost. I was able to determine that is caused by something in the p2 configuration changes since replacing the config.ini that was installed with the one exported from the product fixes the about dialog, but break the configuration for update.

    Rich Scott

  2. Kai Tödter

    Rich,

    I am also experiencing the missing feature branding in my MP3 Manager (that I recently enabled to use p2 for self-updating). Please let me know if you find a solution using the config.ini created by the director application.

  3. chengdong

    Kai:

    Great blog! I find many useful things here.
    I am trying to follow your steps, and also reading your slides at 2008 eclipsecon. Can you give me a point to the maildemo location? It seems that the old web link does not work (http://max-server.myftp.org/trac/mp3m). Thanks

  4. Frank

    Kai,

    I followed your steps. At #7, when clicking the menu Help -> Software Update, I saw an error message:

    ‘Cannot launch the Update UI. This installation has not been configured properly for Software Updates.’

    I was stuck here. Any idea about how to get thru it? Thank you very much!

  5. Topher Fangio

    Hi Kai,

    I am having a bit of difficulty executing step 5 (running the director app). I created a new run configuration that ran the p2.director app with all of the program and VM arguments that you specified, but I am getting a ClassNotFoundException for Main…it simply cannot find the main method to execute. How did you go about running the director app?

    Thanks very much for your post about this!

  6. Dimitri Missoh

    Hi Kay! I also tried to get the p2 stuffs works. Got also Frank’s issue ‘Cannot launch the Update UI. This installation has not been configured properly for Software Updates.’ Any hint?
    Thanks.

  7. Kai Tödter

    @Frank, Topher, Dimitri
    Sorry for responding so late, I am totally busy now… Probably something has changed with the latest Eclipse versions. If I find the time I will step through the list with Eclipse 3.4.1 and see if I run in similar problems. Then I will update the post.

  8. Chris Cool

    @Frank, Dimitri
    I ran into the same problem and found that my config.ini did not contain the eclipse.p2.data.area and the eclipse.p2.profile properties. I manully added these to config.ini and I was able to launch the updates dialog:

    eclipse.p2.data.area=platform:/base/p2
    eclipse.p2.profile=MyProfile

    I ran into other issues though as my config.ini is being generated as part of my build, so I had to add to my eclipse.ini file.

    Another problem I have is that when I open the Updates dialog, I see my product listed as ‘installed’ but the ‘Update…’ button is disabled. Anyone else run into this?

  9. Mustafa Abdat

    Scenario:

    I managed to deploy my application which is feature-based with P2 and I’ve been trying to enable automatic update on my application, however when I pressed the “check for updates”, “Install New Software” and “Installation Information” it tells me “Cannot launch the Update UI. This installation has not been configured properly for software updates”.

    Here are my questions:

    1. Does this problem reside in my deployed product configuration or the update site ?

    2. I’ve tried to install the product by using p2installer which suppose to download everything from my update site (includes the .exe files,etc). However after the download completes I only see “plugin” folder and artifact.xml in my new folder, nothing else. Can anyone help me with this ?

    Thank you for your time and help.

  10. Peng-liand Wang

    Hi Kai,

    I am working on a software project that uses Swing-based UIs, and we’d like to use P2 for software updating. But the UIs of Equinox-P2 are SWT-based. Do you know there are any Swing-based P2?

    Thanks,

    Peng

  11. dejohnny

    The “Cannot launch the Update UI. This installation has not been configured properly for software updates” problem.

    I ran into this problem while using Eclipse 3.4.0 on OpenSolaris-2008-11. This problem can be fixed through UI configuration.

    On the Eclipse menu click

    Window|Preferences|General|Capabilities

    Make sure that Classic Update is checked, or simply just Enable all.

    This worked for me, although now, I have two “Software Updates” commands on the help menu.

  12. Udo

    The “Cannot launch the Update UI. This installation has not been configured properly for software updates” problem.

    I had this some days ago, too, and fixed it by correcting the config.ini file in the application. After that the update dialog appeared again.

    I think the properties eclipse.p2.data.area and eclipse.p2.profile are necessary to let the dialog show correctly.

  13. Jason

    Hi Kai,
    Do you encounter the following error when you play with the P2 self update demo project?
    An error occurred while collecting items to be installed
    session context was:(profile=profile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=null –> [R]org.eclipse.equinox.p2.examples.rcp.cloud.product_root.win32.win32.x86 1.0.1.200904032238, action=).
    The required Touchpoint: org.eclipse.equinox.p2.native 1.0.0 touchpoint for the collect action is not included in the installation manager configuration.
    The required Touchpoint: org.eclipse.equinox.p2.native 1.0.0 touchpoint for the collect action is not included in the installation manager configuration.

    Here is my steps:
    1. Down the source from the eclipse site(org.eclipse.equinox.p2.examples.rcp.cloud and org.eclipse.equinox.p2.examples.rcp.cloud.releng), run –> Build Cloud Example from Build Cloud Example.launch file by right clicking. A builded product is generated by default. It runs;
    2. Change the version number from 1.0.0 to 1.0.1 both in cloud.product and plugin.xml files and build again, it runs ok;
    3. From 1.0.0 version product click Install new softerware and add the local site I generate the 1.0.1 version location, new version is found. But when I select the new version and click Next –> Finish the exception above occurrs. I have no any idea to sovle the problem. Will you please help me for this?

    Thanks a lot in advance.

  14. izyl

    Hello, p2 updates works fine for me.
    I can update my product, but i’m wondering how to allow user to install a new plugin.
    I can make another site but what if i want to use the same update site so that i can enable automatic update.

    Is it possible to automate the update from the begining (first time the product is opened).

    As u said, i had to add the site manually through the p2 ui so i can download the new version or use the new update site with the new plugins.

    Have you got a clue for me?

  15. Vincenzo Caselli

    Hi Kai,
    at point 11 you say:
    “11. So I added the repository c:/java/RCP/p2-maildemo/repository manually as a new site, and voila, the new version 1.0.1 was displayed and ready for update.”
    But how did you do this? I do not have any “Add…” button to the right of the “type filter text” text box (like in the IDE), nor any “Window, Preferencies..” to add a new Update Site. We are near to the end, but are missing the last step …
    Thank you very much
    Vincenzo Caselli
    RCP-Vision.com

  16. Vincenzo Caselli

    More doubts:
    * we are following your tutorial with Eclipse 3.5 and when using the director app we discarded the “version” option (not allowed), is it right or is there an equivalent option?
    * we are using the option “-application org.eclipse.equinox.p2.director” instead of “application org.eclipse.equinox.p2.director.app.application” since the latter is warned as deprecated in the console
    * at point 10 you say “Exported the new product version 1.0.1 in the SAME location, to update the metadata/artifact repositories.”: we are supposing we have to remove folders “eclipse” and “repository” each time before the Export, since if we do not do this we are receiving a conflict version error. Is this right?
    * we are supposing the director app is to be launched just the first time, to create the initial setup. Only the Export has to be performed at each update phase. Right?

    Thank you so much Kai.
    Vincenzo Caselli

  17. Carsten Nikiel

    @Kai for point 11 you might be able to use a p2.inf file at the same level as the .product file with this content:
    instructions.configure=
    addRepository(type:0,location:PATH-TO-REPOSITORY);
    addRepository(type:1,location:PATH-TO-REPOSITORY);

    Since I am using eclipse 3.5 too to get this to work I face the very same issues and questions that Vincenzo Caselli has.

  18. Kai Tödter

    So much changed with 3.5. I currently port all the p2 and build stuff of my mp3m to 3.5. I works now, but I have to figure out some strange things. As soon as I am done I will blog about it.

  19. Joe

    I am having so much problems trying to add self-updating to my RCP App. Could you please provide the source of the latest rcp mail demo that has p2 updating working? It would be greatly appreciated. Thanks so much!

  20. Andrey

    Thanks for very valuable tutorial.
    Some important thing for improvement.
    Please note that in

    >-installIU p2_maildemo.product

    This should be the product ID and not a path to a *.product file. I spent half a day to figure this out.

    For example if in you *.product file you use the following id My_definition.My_tool

    The option should look like:
    -installIU My_definition.My_tool

    Another thing that is frustrating is that building/installation of RCP takes hours. Probably it is only in my case. Something happens. I don’t know if it is Ok, since the only sign that is not finished is that the Windows Task Manager shows heavy CPU load. 🙁

  21. Andrey

    Oups, after 1 hour of building it is ended with an “Out of memory” error. 🙁

Leave a Reply

I accept the Privacy Policy