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.
The set of plug-ins available for your application development is defined by the plug-ins in your workspace in addition to the plug-ins defined by your target platform. For example, the SWT and JFace plug-ins are typically provided by your target platform. By default, the plug-in installed in your Eclipse IDE installation are used as target platform.
It is good practice to develop and build against a explicit target definition which is stored in a configuration file. This way the plug-in dependencies and the used versions are controlled and specified during the development. A target definition file is typically shared between the developers to ensure that everyone is using the same basis for development. If such a target definition file does not exists, than every developer develops against his version of the Eclipse IDE, which can lead to incompatible changes.
You can specify your target platform with a target definition file. A target definition file can be created via.
You can add new locations via the Add… button in the Locations section. To add an Eclipse p2 update site, select Software Site and specify the URL.
Once you have a target definition file, you can set it as the target platform in your Eclipse IDE. This can be done via the Set as Active Target Platform link in the Target definition editor.
|If you create a target platform, wait until the target platform is completely resolved before setting it as target platform.|
All plug-ins you are planning to use in your application and test code must be included in the target definition. For example, if you want to use SWTBot for unit tests, add SWTBot for SWT Testing features from http://download.eclipse.org/technology/swtbot/releases/latest/ to your target platform.
You can switch the target platform in the Eclipse Preferences. Select.
A preferred way of defining your target platform is to use (p2) update sites. These are of the same type as the update sites that you used 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 popular build systems like Maven/Tycho do not support file based target definition files.
In this exercise you create a target definition which can be used to develop an Eclipse RCP application.
Create a new project called com.vogella.rcp.target of type General via.
Create a new target definition file via themenu path.
com.vogella.rcp.target as file name and press the Finish button.
This creates a new file and opens the Target Definition editor. Press the Add… button.
Select Software site in the following dialog.
Press the Next button and enter the update site URL of your target release in the Work with selection box. This is for example:
Remove the Group by Category flag and add the following components:
Eclipse Platform SDK
Components for RCP
Equinox Target Components
The native launchers for the platform
After you close this dialog, the target definition is resolved, which will take a while.
Avoid using the Eclipse IDE until the target is resolved. Resolving targets is using the network and you do not want to interrupt this, as this might result in an inconsistent target definition.
After the target is resolved, press the Set as Active Target Platform to activate it. Please note that your version numbers might be different.
In case you are building against http://download.eclipse.org/releases/latest you should replace the version in your target file with
This way, you will always use the latest available version from your update site.
<target name="com.vogella.rcp"> <locations> <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit"> <repository location="http://download.eclipse.org/releases/latest"/> <unit id="org.eclipse.platform.sdk" version="0.0.0"/> </location> <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit"> <repository location="http://download.eclipse.org/releases/latest"/> <unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/> </location> </locations> </target>
To check if your target definition is active, try to open the
IJavaProject class via Ctrl+Shift+T (Open Type).
This should not be possible, as this class is not part of your target platform.
Your target platform depends on external update sites and the availability of the network. Theses update sites might change over time, so you should be able to revert your target platform settings in case you face issues.
If you face issues with your target platform, switch to the IDE as target platform and afterwards switch back to your target definition.
That sometimes solves target resolution issues.
If the target definition does not work, e.g. because of network issues, you can use your Eclipse IDE as target platform via.
I hope you enjoyed this tutorial. You find an extended online training at the Eclipse RCP online training website.
Copyright © 2012-2019 vogella GmbH. Free use of the software examples is granted under the terms of the Eclipse Public License 2.0. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.