How to provide P2 update support for configuration files - eclipse-rcp

We have a RCP application which includes domain specific configuration files(properties file, and few folders containing xml's) in its installation directory. We have provided update support through P2 framework which works for plug-ins and features, But now we are planning to provide update support for the configuration files as well.
Is it possible to update the configuration files with P2 framework?
Any link to do the same would be helpful.

What you need is the so-called "root files" (do not mix up with "root IU").
An example of those is org.eclipse.equinox.executable feature which includes the .exe/.so files which are installed to the root directory of your product.
There are several ways to achieve it, here the simplest one:
create a feature project named xyz.feature
place all files you want to have in the root of your product into the /xyz.feature/root.files/ directory
create the following entry in the /xyz.feature/build.properties:
root=root.files
Include this feature in your main feature / product configuration
Export the feature/product into a p2 repository
You can examine the resulting p2 repo to see what p2 does exactly with this magic "root=" property key on export.

Related

How to copy or share a linked folder from one project on another in Eclipse

I have a linked folder anyname in a Eclipse (Mars) project A (is a Dynamic Web Project). I created project B and want to also link anyname to it without starting from scratch. Stated other way, how do I copy the linked resource from A to B? Is there a way to configure anyname as a "global" shared linked folder and later include in other projects? anyname contains a standar in house classes and need to use it in several projects

is site.xml compulsory for eclipse update site?

I have used eclipse Features And Bundles Publisher to create a p2 metadata folder. But failed add the same folder as local site as eclipse keep on complaining Unable to find the site.
I could find content.xml and artifacts.xml but site.xml NOT generated through publisher command. I doubt if I have to create a site.xml manually.
FYI I am using eclipse KeplerSR2.
The p2 publisher should create a structure like this. Depending on pack attributed the content and artifact repository files [content and artifact] might be jared.
<repo-root-dir>
features
featureA.jar
...
plugins
pluginA.jar
...
content[.xml|.jar]
artifacts[.xml|.jar]
You won't get and won't require an update site file.
Make sure to clean the location you use from the Eclipse -> Preferences -> Available Softwares Sites. Eclipse is caching the repo metadata.
Yes you must have site.xml for update site from update_site
To create an update site you must develop a site.xml file and build the site. PDE provides an editor and project for creating sites. A site will contain one or more features organized into categories.
See how to create site.xml

What is 'the' way to add a bundle jar to a p2 based Eclipse target platform?

I'm wondering: What is the best way of adding a bundle to a p2 based target platform?
I don't want to use local directories, I want to have a target platform that works 'out of
the box' for all our team members.
Right now I manage, but I have a feeling I'm missing a more straightforward way of
doing this.
My situation is as follows:
My target platform has a bunch of p2 locations, hosted at our on-site server.
Most are mirrored repositories, but I have one I use for 'miscellaneous' bundles.
This is how I add a bundle to the target platform.
I switch to another workspace, which does use a bundle directory with jars.
I add the bundle jar to that directory.
I add the bundle to my 'third party' feature
I export the feature, and upload it to our server, deleting the old one
I switch back to my normal workspace, and reload the target platform link.
Sometimes eclipse gets a bit confused and keeps using a cached version, but in
general this approach works.
My question:
Is there a easier way?
Is there a more 'incremental' way? I rebuild the p2 repository, instead of adding
a feature with a new version.
You should have a look at p2's publisher and mirror tools. The publisher creates p2 metadata, and with the mirroring, you can copy artifacts into an existing p2 repository (given you have file system access).
There is also a Maven front-end to these tools provided by the Tycho project.

How to use b3 to create a local mirror of the stuff I need?

I'm using some 3rd party libraries to create my RCP application. These libraries are available as update site / p2 repository, and they are provided by eclipse (e.g., the RCP target, EMF) or by a third-party repository. Accordingly, I've created a target file to describe what I'm using to build my application.
Due to a recent outage of one of these repositories, I want to have a local mirror of all the stuff I'm using to build my application. Somebody told be to look at b3, but I need some additional help. Following the tutorial, I've copied from my target file the p2 repositories and created some validation rules (according to the feature I use).
However, when I start the build, it mirrors huge parts of the eclipse's indigo repository (including, for example, the JDT, WTP, and linuxTools, which are NOT required directly or indirectly by my RCP app).
Is it possible to limit the mirror to the features listed in my target file?
I have only the Helios version of b3 installed (not sure how it works in a newer one, but probably its similar), there I can add some child items to the Mapped repository elements to add an exclusion rule to remove some items, or add some specific features or plugins.

Create eclipse P2 update site from folder containing bundles?

Typically an eclipse p2 update site is created inside eclipse through the process of creating a feature project containing one or more plugins/bundles and adding this feature to an eclipse update site project. Finally the update site is build and can be referenced through the update manager in eclipse.
But is it possible to create a p2 update site outside eclipse from a folder only containing a set of already build plugins?
I have looked at:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_publisher.html
but it assumes that both the bundles AND features are already created.
I have also looked at:
http://wiki.eclipse.org/Equinox_p2_director_application
http://wiki.eclipse.org/Equinox_p2_Getting_Started_for_Releng
but that does not describe how to create a p2 site from a list of bundles.
To simplify my question:
Is it possible to create a full working p2 update site from a local folder containing osgi bundles?
Publisher is the one to generate the p2 repository from bundles.
Update:
If you want to let your product showing in p2 UI, you can create p2.inf in your top feature,
properties.1.name=org.eclipse.equinox.p2.type.group
properties.1.value=true
Of course, you also could add it to a category via p2 advice file.