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.
1. Target platform for defining available plug-ins for development
The set of plug-ins which you can use for your development or your build process to resolve the project dependencies is defined by the plug-ins in your workspace in addition with the plug-ins defined by your target platform. For example your plug-ins use classes from the SWT and JFace plug-ins. By default the plug-in installed in your Eclipse IDE installation are used as target platform.
A target definition file is typically shared between the developers to ensure that everyone is using the same basis for development.
It is good practice to develop and build against a specific target definition. This way it can be ensured that dependencies and their versions doesn’t change during the development. Via an explicit target definition it can also be ensured that all developers in a team are using the same dependencies and versions, rather than being dependent on the versions installed in the IDE of every developer.
2. Defining a target platform
You can specify your target platform with a target definition file. With such a file you define the available plug-ins and features.
|A target platform can be defined based on software sites (p2 update sites) or other means. As build systems like Maven Tycho support only p2 update sites, it is recommended to use only these.|
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 Target Platform link in the Target definition editor as depicted in the following screenshot.
|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 popolar build systems like Maven/Tycho do not support file based target definition files.
3. Exercise: Setting up a target platform
In this exercise you create a target definition which is used to develop an Eclipse RCP application.
3.1. Creating a project of type general
Create a new project called com.example.rcp.target of type General via.
3.2. Creating a target definition file
Create a new target definition file via themenu path.
com.example.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 the target release in the Work with selection box. This is for example: http://download.eclipse.org/releases/neon for the Eclipse 4.6 (Neon) release.
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, ensure to select the non "black and white" entry if this exists. This entry is empty.
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 Target Platform to activate it. Please note that your version numbers might be different.
3.3. Validate setup
To check if your target definition is active, try to open the `IReconcilingStrategy`class via Ctrl+Shift+T (Open Type). This should not be possible, as this class is not part of your target platform.
3.4. Solving potential issues for development
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.
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.
5. About this website
6. Target platform resources
6.1. vogella GmbH training and consulting support
|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.
Appendix A: Copyright and License
Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.