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

<p2.publish.featuresAndBundles
repository="file:/path/to/destination/repository" e.g. ${buildDirectory}/repo
publishArtifacts="true"
compress="true"
append="true"
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" />
<source>
<repository location="file:/path/to/source/repository" />
</source>
<iu id="pluginName" version="" />
</p2.mirror>

Notes:
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.

Comments

  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

    ReplyDelete

Post a Comment

Popular posts from this blog

Drawing in Graphiti

Trouble signing Apps for OSX Mountain Lion

Spikes in RabbitMQ + NodeJS latency test