Support free tutorials

vogella training Training Books



Eclipse Target Platform - Tutorial

Lars Vogel

Version 7.3

18.02.2014

Eclipse Target Platform

Via a target platform you define which set of plug-ins and what version of Eclipse you develop against. This tutorial describes how to setup your target platform for Eclipse Plug-in and RCP development.


Table of Contents

1. Target Platform
1.1. Defining available plug-ins for development
1.2. Target platform definition
1.3. Using the IDE as target platform
2. Defining a target platform
3. Exercise: Setting up a target platform
3.1. Creating a target definition file
3.2. Activate
3.3. Validate
3.4. Solving potential issues
4. Learn more about Eclipse 4 RCP development
5. About this website
5.1. Donate to support free tutorials
5.2. Questions and discussion
5.3. License for this tutorial and its code
6. Links and Literature
6.1. Source Code
6.2. Eclipse Resources
6.3. vogella Resources

Get the book Eclipse RCP book

1. Target Platform

1.1. Defining available plug-ins for development

During development of your Eclipse plug-ins, you use other plug-ins for example the SWT and JFace plug-ins.

The set of plug-ins which you can use for your development is defined by the plug-ins in your workspace in addition with the plug-ins defined by your target platform.

By default your Eclipse IDE installation is used as target platform

1.2. Target platform definition

You can specify your target platform with a target definition file. With such a file you define the available plug-ins and features.

Tip

A target platform can be defined based on software sites (p2 update sites) or other means. As the new build system like Maven Tycho support only p2 update sites, it is recommended to use only these.

A target definition file is typically shared between the developers to ensure that everyone is using the same basis for development.

1.3. Using the IDE as target platform

Developing against your IDE installation has the following disadvantages:

  • it makes you dependent on your version of the Eclipse IDE

  • it can lead to problems if developers are using different versions of Eclipse because the API might be different

  • it makes it difficult to upgrade the set of available plug-ins for every developer at the same time

  • it also requires that you install every plug-in required for your product either in your workspace or in your Eclipse IDE

  • it can happen that you might unintentionally add plug-ins from the Eclipse IDE to your development

To solve these problems, it is recommended to configure a target platform explicitly via a target definition file.

2. Defining a target platform

A target definition file can be created via FileNewOther...Plug-in DevelopmentTarget Definition.

Define File name for Target Definition

You can add new locations via the Add... button in the location section. To add an Eclipse p2 update site, select Software Site and specify the URL.

After you created your target definition file, you can set it as the target platform in your Eclipse IDE via the Set as Target Platform link in the Target definition editor as depicted in the following screenshot.

Setting the new defined target definition as target for the development

You can switch the target platform in the Eclipse Preferences. Select WindowPreferencesPlug-in DevelopmentTarget Platform.

Setting the target definition via the Eclipse Preferences

The most effective way of defining your target platform is to use p2 update sites. These are of the same type as the update sites that you use to install a new set of plug-ins. If the content in the update sites defined by your target platform changes, your local set of plug-ins can be updated.

It is also possible to define your target platform based on plug-ins in your file system, but this is not recommended as certain build system like Maven/Tycho do not support file based target definition files.

3. Exercise: Setting up a target platform

3.1. Creating a target definition file

Create a new project called com.example.e4.rcp.todo.target of type General.

Create a new target definition file via the FileNewOther...Plug-in DevelopmentTarget Definition menu path.

Define target definition file

Press the Add... button.

Add content to target definition file

Select Software site in the following dialog.

Add content to target definition file

Press the Next button and enter the http://download.eclipse.org/eclipse/updates/4.3 URL. This is the update site for the Eclipse 4.3 (Kepler) release. Include the Eclipse RCP SDK entry from the Kepler update site. You may have to remove the Group by Category flag.

Include the Equinox p2 SDK from the Kepler update site.

If you use SWTBot for unit tests, add SWTBot for SWT Testing features from http://download.eclipse.org/technology/swtbot/releases/latest/ to your target platform.

The result should look similar to the following screenshot. Please note that your version numbers might be different.

3.2. Activate

Afterwards press the Set as Target Platform to activate it. See Section 3.4, “Solving potential issues” in case you have problems with your new target platform.

3.3. Validate

Try to add the org.eclipse.jdt.ui plug-in as dependency to one of your plug-ins. This should not be possible.

3.4. Solving potential issues

Your target platform depends on external update sites and their packaging of plug-ins. Theses update sites might change over time, so you should be able to revert your target platform settings in case you face issues.

You can switch back to your Eclipse IDE as target platform via WindowPreferencesPlug-in DevelopmentTarget Platform.

4. Learn more about Eclipse 4 RCP development

I hope you enjoyed this tutorial. You find this tutorial and much more information also in the Eclipse 4 RCP book from this author.

5. About this website

5.1. Donate to support free tutorials

Please consider a contribution Support free tutorials if this article helped you. It will help to maintain our content and our Open Source activities.

5.2. Questions and discussion

Writing and updating these tutorials is a lot of work. If this free community service was helpful, you can support the cause by giving a tip as well as reporting typos and factual errors.

If you find errors in this tutorial, please notify me (see the top of the page). Please note that due to the high volume of feedback I receive, I cannot answer questions to your implementation. Ensure you have read the vogella FAQ as I don't respond to questions already answered there.

5.3. License for this tutorial and its code

This tutorial is Open Content under the CC BY-NC-SA 3.0 DE license. Source code in this tutorial is distributed under the Eclipse Public License. See the vogella License page for details on the terms of reuse.

6. Links and Literature

6.1. Source Code

Source Code of Examples

6.3. vogella Resources

TRAINING SERVICE & SUPPORT
The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”. The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.