Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 vogella GmbH
Table of Contents
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.
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 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.
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.
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
A target definition file can be created via→ → → → .
You can add new locations via the Software Site and specify the URL.button in the Locations section. To add an Eclipse p2 update site, select
Once you have a target definition file, you can set it as the target platform in your Eclipse IDE. This can be done via thelink 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.
You can switch the target platform in the Eclipse Preferences. Select→ → → .
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 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 certain build system like Maven/Tycho do not support file based target definition files.
Create a new project called com.vogella.build.targetdefinition of type General via → → → → .
Create a new target definition file via the
as file name.
Press the Add... button.
Select Software site in the following dialog.
Press thebutton and enter the http://download.eclipse.org/eclipse/updates/4.4 URL in the Work with selection box. This is the update site for the Eclipse 4.4 (Luna) release.
Remove the Group by Category flag and add the following components:
Table 1. Target components
|Eclipse RCP SDK||Components for RCP|
|Eclipse Platform Launcher Executables||The native launchers for the platform, ensure to select the non "black and white" entry if this exists. This entry is empty.|
|Eclipse JDT Plug-in Developer Resources||Required for JUnit|
|Equinox p2, Provisioning for IDEs||Update functionality|
The result should look similar to the following screenshot. Please note that your version numbers might be different.
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.
Afterwards press the Set as Target Platform to activate it. See Section 3.4, “Solving potential issues for development” in case you have problems with your new target platform.
Try to add the
plug-in as dependency to one of your plug-ins. This should not be
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→ → → .
I hope you enjoyed this tutorial. You find this tutorial and much more information also in the Eclipse 4 RCP book from this author.