Jun 01 2010
Generating p2 meta data from command line
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.
Thank you for the enty. p2 seems to have lots of cool (hidden) features.
Thank you it is very useful.
Now I am looking for a solution to update the p2 target without overwrite it. Any idea ?
@Xavier Adding -append option should do the trick.
Thank you, it works fine.