Tuesday, January 4, 2011

How to get rid of .blobstore during mirroring eclipse update site using p2.mirror ant task

Mirroring eclipse p2 repositories is fairly simple. It just requires to read an article here and after that it supposed to be simple, but after it finally works I noticed that format of p2 repo it creates is not the same as downloaded from eclipse. The difference is in the way artifacts packed with pack200 are stored. Whatever you do with p2.mirror parameters all pack200 packed artifacts are published in .blobstore instead of *.jar.pack.gz files.

After digging repos available on eclipse I found a solution to controls that. Magic is in format attribute of destination tag. Documentation says: "A URL to another repository from which to copy the repository name and other properties". It gave me an idea to find p2 repo on download.eclipse.org with jar.pack.gz files and check its properties in artifacts.xml. Soon I noticed a property that controls it

<property name="publishPackFilesAsSiblings" value="true/">

So if you want to get rid of .blobstore in mirrored p2 repo just create artifacts.xml file like



  
     <property name="publishPackFilesAsSiblings" value="true"/>
  

Then in destination tag format attribute use URL to folder that contains artifacts.xml file with content provided above and p2.mirror task will copy 'publishPackFilesAsSiblings' attribute to your local mirror. This will force mirroring task to store artifacts packed with pack200 as jar.pack.gz files.