How do I mirror a feature?
Question
With the p2 ant tasks, it's pretty simple to mirror the plugins for a feature.
But how do I mirror everything necessary to install a feature?
Solution
Couldn't get p2.mirror
working; the task either mirrors too much (like all versions of a feature even if you're only interested in the last or a specific one) and/or too little (like just the feature but none of the dependencies).
My solution was like this:
- Unpack Eclipse to
eclipse-template
- Create a copy as
eclipse-install
- Install the feature in
eclipse-install
- Delete any file in the copy which exists in the version from step #1 (
cd eclipse-template ; find . -type f -exec rm "../eclipse-install/{}"
).
That leaves you with the feature and plugin files. Use org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
to turn that into a p2 repo (see the docs for details).
[UPDATE 2011-11-01] There is another solution if you don't need to run this from the command line.
- Create a "Target Definition" in an Eclipse project (create a new one or use an existing one, doesn't matter)
- Add update sites to this *.target file
- Select the features you want
- Click on the tiny "Export" button in the top right corner of the Target Definition Editor (next to "Set as Target Platform")
That will export all the selected features with the exact version that you selected plus all dependencies in a folder of your choice.
The target editor is a bit clumsy and slow but it works.
Keep the file under version control because the target editor sometimes messes up.
OTHER TIPS
I am using the following Ant code to mirror 2 features in a single repository:
<!-- Creates single p2 repo from 2 repos -->
<p2.mirror>
<repository location="file:///${DESTINATION}/repo-name" append="false"/>
<source>
<repository location="file:///${feature1-repo}/feature1"/>
<repository location="file:///${feature2-repo}/feature2"/>
</source>
</p2.mirror>
Moreover you can use the <iu>
and the feature's id to specify the feature to be mirrored. Features id must be specified in the following way:
your.feature.id.group.group.group
If you have specific plateform configurations for your feature, then the IU becomes
your.feature.id.win32.win32.x86 (OS, Widget system, Architecture)