Back to top

vogella training Training Books

Eclipse Target Platform - Tutorial

Lars Vogel

Version 7.1

04.12.2012

Revision History
Revision 0.1 - 0.7 14.08.2007 - 03.09.2007 Lars
Vogel
created
Revision 0.8 - 7.1 03.11.2008 - 12.04.2012 Lars
Vogel
Several bug fixes and enhancements

Eclipse Target Definition

This tutorial describes how to setup your Target Platform for Eclipse Plug-in and RCP applications. Via a target definition file you define against which set of plug-ins and which version of Eclipse you develop.


Table of Contents

1. Target Platform
1.1. Developing against the Eclipse IDE
1.2. Defining your Target Platform
1.3. Creating a Target Platform definition
2. Questions and Discussion
3. Links and Literature
3.1. Source Code
3.2. Eclipse Resources
3.3. vogella Resources

1. Target Platform

1.1. Developing against the Eclipse IDE

If you develop Eclipse plug-ins, you reuse components of the Eclipse platform, for example SWT or JFace.

By default these plug-ins are sourced directly from your Eclipse IDE.

This is not an ideal approach, as this makes you dependent on your version of the Eclipse IDE. This can lead to problems, if developers are using different versions of Eclipse. It also makes it difficult to upgrade these plug-ins for everyone at the same time.

If you followed this approach you would also need to install every plug-in required for your product either in your workspace or in your Eclipse IDE.

Another problem with this approach is that you might unintentionally add plug-ins from the Eclipse IDE to your product.

1.2. Defining your Target Platform

Via a target platform you define the set of plug-ins which are available for development. For example you define which version of the SWT and JFace plug-in is part of your target platform.

This makes you independent from the Eclipse IDE you are using. Developers with different versions of Eclipse will compile their work against the same set of plug-ins.

A target tlatform is defined via a .target file. This target file defines the list of plug-ins and features. You typically share this target file between different developers to ensure that everyone is using the same basis for development.

The most effective way of defining your Target Platform is to use an (Eclipse p2) update sites. These are of the same type as update sites which you use to install a new set of plug-ins. If the content in the update site defined by your target platform is changed, your local set of plug-ins can also be updated.

It is also possible to define your target platform based on plug-ins in your file system.

1.3. Creating a Target Platform definition

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 have defined your Target Definition file, you can set it as the target in your Eclipse IDE via the Set as Target Platform button.

Setting the new defined target definition as target for the development

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

Setting the target definition via the Eclipse Preferences

2. Questions and Discussion

Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.com Google Group. I have created a short list how to create good questions which might also help you.

3. Links and Literature

3.1. Source Code

Source Code of Examples

3.3. vogella Resources

vogella Training Android and Eclipse Training from the vogella team

Android Tutorial Introduction to Android Programming

GWT Tutorial Program in Java and compile to JavaScript and HTML

Eclipse RCP Tutorial Create native applications in Java

JUnit Tutorial Test your application

Git Tutorial Put everything you have under distributed version control system