licenses p2 pde

Implementing shared licenses with 3.7M5

This is the best Eclipse license I’ve ever seen.

Image © chriscardinal, licensed under Creative Commons by-nc-sa 2.0

Conversely, dealing with license files in Eclipse features is a bit painful.  Today, each time the Eclipse license changes, you need to copy the new license files to your features.  The license files included in the Eclipse SDK are highlighted below:

These same files are included in the 46 features that the Eclipse and RT Equinox project builds.  This is very tedious to update when the license files change. Lots of copy and paste. The license text also appears in the

In Eclipse 3.7M4,  the PDE and p2 teams added support for shared licenses.

The license files will be copied from the license feature to the feature that refers to it.  In 3.7M5, I modified our features to use this shared licenses. For instance, the beginning of the feature.xml for the Eclipse SDK now looks like this:

To implement this, I followed these steps. 

1. Create a license feature. This feature doesn’t include any bundles or features. It only stores the license files which its reference.   The has only two properties – the licenseURL and license. 

2. Update the existing features to reference the license feature.  Remove the license files from these features.  Remove the references to the license files from your feature’s  The values will be inherited from the of the license feature.  Remove the name and values of licenseURL and license from the These will be included from the license feature. Ensure that you don’t have duplicate properties in the of the license feature and feature your are updating. This will cause a build failure.

3.  Update your map files to include to the new feature. You don’t need to nest the feature in another feature to fetch it, this happens automatically. For example, this is where our license feature is located


4. Run a test build. Fix typos until you have a clean build. Verify that all your features still include the appropriate license files. 

There isn’t an IU for the license feature included in the p2 repository.  The license text is included in the metadata.

Note that you’ll need to build with 3.7M5 bundles.  There was a bug in the 3.7M4 bundles that prevented shared licenses from working in generated source features.

The advantage of this approach is that when the license files are updated, we’ll only need to update the license feature.  We’ll also have to increment the versions of the license feature in the referring feature, but that’s a simple search and replace. 

Some other implementation details: I could have also stored the copyright information in the of the license feature. However, the copyrights of our features are not identical, so I didn’t choose this approach. This may be useful for other teams.

Thanks to the  PDE and p2 team for implementing this!

Further references

Bug 306818 – Improve license support in p2.
License mechanism description in wiki
Bug 332662 – Adopt new feature that allows to share the license file

3 comments on “Implementing shared licenses with 3.7M5

  1. Very cool. Maintaining this stuff has always been an annoyance. You mentioned copyright text. Is it possible to store other shared properties such as Update Site names, etc.. using this mechanism?


  2. Miles, all the properties in the license feature will be inherited by the feature referencing it. Thus you could inherit the copyright text. I don't do that because the same text doesn't apply to all our features. The same thing applies for us for our feature names, they are all different 🙂


  3. This blog contains some important missing bits.

    The defines two


    The values for the former is the actual license text, which is hard to get in .properties format. (i.e. using \ for continuing on the next line. The later is the URL for the local file or http url.

    When setting the shared license, the following entries in the feature.xml remain unchanged.
    These should be edited in the xml editor of the feature editor and set to:


    this will replace with the properties in the from the shared license feature.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: