Jun 01 2010

Generating p2 meta data from command line

Published by at 9:15 pm under Eclipse,IT,Java

Many times when working with Eclipse RCP I had to generate ad-hoc updatesites (usually containing some 3rd party plug-ins). What I usually did to achieve this (with Eclipse IDE):

  • create new feature project
  • add plug-ins to the feature
  • create new updatesite project
  • add the feature to the updatesite (pre-p2 style – site.xml)
  • export newly created updatesite (letting Eclipse to deal with creating p2 meta data)

Since I needed to automate this process I started researching on p2 capabilities and found out that it can be done from command line using FeatureAndBundlesPublisher application. Sample command line invocation to do it:

%ECLIPSE_EXE% -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/%P2_TARGET% -artifactRepository file:/%P2_TARGET% -source %P2_SRC% -compress -configs win32.win32.x86 -publishArtifacts

Where:

  • ECLIPSE_EXE – points to Eclipse executable;
  • P2_TARGET – path to an empty directory where p2 repository should be created;
  • P2_SRC – path to the directory with /plugins subdirectory and plug-ins to be published (jar files) inside;
  • -compress parameter is optional. It compresses artifacts.xml and content.xml to jar (zip) files.

10 responses so far

10 Responses to “Generating p2 meta data from command line”

  1. Lars Vogelon 02 Jun 2010 at 5:42 am

    Thank you for the enty. p2 seems to have lots of cool (hidden) features.

  2. Xavieron 02 Jun 2010 at 12:44 pm

    Thank you it is very useful.

    Now I am looking for a solution to update the p2 target without overwrite it. Any idea ?

  3. Radoslaw Urbason 02 Jun 2010 at 1:00 pm

    @Xavier Adding -append option should do the trick.

  4. Xavieron 02 Jun 2010 at 2:05 pm

    Thank you, it works fine.

  5. bobon 18 Nov 2010 at 2:38 pm

    The ouput (content of the %P2_TARGET% folder) of the FeaturesAndBundlesPublisher application is not recognized in eclipse helios 3.6.1 update manager. Features must be present for the bundles to make it a valid p2 site.

  6. Radoslaw Urbason 18 Nov 2010 at 3:06 pm

    @bob FeaturesAndBundlesPublisher generates valid updatesite. I would rather say that GUI for updates in Eclipse is not allowing installation of individual bundles but rather only installation of the features.

  7. Markuson 28 Nov 2011 at 9:10 am

    Hi!

    Thanks for the entry. We use this mechanism in our automated build, too.

    Unfortunately, eclispe does not recognize that the features should be grouped into categories, which are defined in the site.xml. The site.xml is located in the same directory where the artifacts.jar and contents.jar are located.

    Do you know if the site.xml needs to be a parameter of the FeaturesAndBundlesPublisher, or would I use the org.eclipse.equinox.p2.publisher.UpdateSitePublisher application instead of the FeaturesAndBundlesPublisher? This takes a site.xml as parameter?!

    Any help is appreciated!

    Markus

  8. Radoslaw Urbason 28 Nov 2011 at 10:56 am

    @Markus
    Have you tried using Category Publisher (application org.eclipse.equinox.p2.publisher.CategoryPublisher)?

  9. Markuson 28 Nov 2011 at 4:23 pm

    Perfect.

    It seems that eclipse is prepared for everything! 🙂

    Thanks for the fast answer!

    Markus

  10. home remedies for acne overnight for sensitive skin

    Radek's Tech Blog » Generating p2 meta data from command line

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.