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
- Plug-in (Core functionality for RCP)
- A Feature (Contains above plug-in)
- Another feature (To list all the eclipse dependencies)
- Product definition plug-in (Contains branding and workbench details)
- 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.
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”.
To begin with, I selected the template for “Hello,World” in next step
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
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.
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.
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.
Open the product configuration file and make sure that the “Product” and “Application” drop-downs have appropriate value selected.
Also go to “Dependencies” tab and selected the two features created in the above step.
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.
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.
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
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)