Friday, January 14, 2011

Two Eclipse p2 repository operations to make you happy

On the integrations side of the Eclipse business I often happen to need two things:
1. add a random OSGi jar to repository
2. copy from one repository to another

Looking thru p2 manual it's not always entirely obvious how to do it, so here goes my take on the subject.
All my automation uses Ant, so I'll speak a bit of Ant now:

1. Add a random OSGi jar to repository

repository="file:/path/to/destination/repository" e.g. ${buildDirectory}/repo
source="/absolute/path/to/folder/with/jar" />

Few notes:
1. source attribute must be an absolute path.
2. source path must contain "features" and "plugins" directories. So if you have only one bundle, make sure to put it under plugins dir first.
3. make sure repository attribute is a URL, not plain path

2. Copy from one repository to another

<p2.mirror verbose="true">
<repository location="file:/path/to/destination/repository" />
<repository location="file:/path/to/source/repository" />
<iu id="pluginName" version="" />

1. Why not use p2.director? It copies only bundles for current architecture
2. Mirror task is still not perfect, but enough for most copying operations, it has some extra options, worth looking into.

1 comment:

  1. Quite informative post ! I am glad to see that you described everything step by step. Thanks a ton. I will definitely go for it and also tell about it to my friends as well.
    comment system