Eclipse product export with features

Spread the love

Sometime back, I started doing a formal release of one of the Eclipse RCP product, I was working on. While doing the release, I came across lot of problems. My product has very simple structure and it consists of

  1. Plug-in (Core functionality for RCP)
  2. A Feature (Contains above plug-in)
  3. Another feature (To list all the eclipse dependencies)
  4. Product definition plug-in (Contains branding and workbench details)
  5. Product definition (Created inside above plug-in)

That seems pretty simple huh!!! But while exporting above structure, I came across lot of things that one may find useful. Let evaluate everything from the beginning.

Simple Plug-n
I first started with the definition of simple plug-in, refer the following screenshot for details. Make sure the option for “Rich Client Application” is selected as “No”.

Sample Plugin

Sample Plugin

To begin with, I selected the template for “Hello,World” in next step

Sample plug-in template

Sample plug-in template

Feature for plug-in
RCP product configuration allows two options while clubbing plug-ins. You can either use “Feature” based product or “Plug-in” based product. I prefer “Feature” based product, as it helps to categorise plug-in easily. Create “Feature” project, which will look similar to following

Sample Feature

Sample Feature

Feature for Eclipse dependencies
This step isn’t mandatory, you can still list down all the required plug-ins in one feature. But as I said earlier, features provide better way to categorise plug-ins. Hence, I preferred to have a separate feature that will only list down the plug-ins that I have developed and another feature to just list down eclipse dependencies required in order to export product. Check below screenshot for details.

Sample Dependencies Feature

Sample Dependencies Feature

Plug-in for Product definition
It’s time to create another plug-in which will be useful for branding the product with Splash screen and intro. Well again, you have a choice to club everything within first plug-in that we created or you can create separate one. I prefer separating things (SRP). Check below screenshot and yeah most important this time choose “Yes” for “Rich Client Application” section.

Sample Product Plug-in

Sample Product Plug-in

Product Definition
Time to create product definition, which will provide us finer control over various customizations for our very own product. Create the product definition, inside the plug-in just created above.

Sample Product Definition

Sample Product Definition

Open the product configuration file and make sure that the “Product” and “Application” drop-downs have appropriate value selected.

Sample Product with Application

Sample Product with Application

Also go to “Dependencies” tab and selected the two features created in the above step.

Product With Features

Product With Features

Lets open the configuration for the feature which will only contain plug-ins created by us. Make sure both the plug-ins (including Plug-in for product definition) is added to the feature.

Plug-in to feature

Plug-in to feature

Once the plug-ins are added, it is time to switch to the feature which should list down eclipse dependencies. But wait!!! do we know the list of dependencies that should be included in the feature. Definitely not, so how can we get the list? Eclipse has a nice feature, which will help us to solve this mystery. Just open the product configuration and locate “Validate” icon available in the toolbar. Click on the icon and it will list down dependencies required by each plug-in we have included in the feature list.

Missing Product Dependencies

Missing Product Dependencies

Note that you will have to click this icon multiple times as and when you start adding the depending plug-ins to the feature. Once all the dependencies are satisfied, the “validate” option will indicate that the product configuration is valid. If you face a problem indicating “Missing Constraint : Import-Package: org.w3c.dom.css…”, just ignore it. Now you are ready to export the product, choose “Export an Eclipse product” and it will prompt you for location where the product should be exported. Here is the final output

RCP Final

RCP Final

Click here to download the source code for all the projects mentioned above. The plug-ins have been tested with Eclipse Kepler (4.3.2)

Leave a Comment.