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. Defining available Java libraries with the target platform

1.1. Using the target platform to define the available libraries

Before you can start developing Eclipse components, you need to define libraries to compile against.

Eclipse uses target files to define the set of available Java libraries (via JAR files) for Eclipse development. This set is called the target platform and is available to the plug-in projects in your workspace.

Using a target file to specify the available libraries and their versions is good practice. A target definition file is typically shared between developers to ensure that everyone uses the same foundation for development.

If no target file is defined and activated, the Eclipse IDE itself is used as the target platform, providing its JAR files as libraries. Avoid this, as it makes the development dependent on the specific version of the IDE being used.

1.2. Creating a target platform

You can create a target definition file by navigating to File  New  Other…​  Plug-in Development  Target Definition.

You can add new libraries via the Add…​ button in the Locations section. Different options are supported, for example:

  • Eclipse (p2) update sites

  • File locations

  • Standard Java libraries from Maven repositories (which require an IDE extension)

The following is an example of a target definition file.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target-platform">
    <locations>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="https://download.eclipse.org/releases/latest"/>
            <unit id="org.eclipse.equinox.compendium.sdk.feature.group"/>
            <unit id="org.eclipse.equinox.core.feature.feature.group"/>
        </location>
    </locations>
</target>

The includeMode attribute of an update site location defines how dependencies of Eclipse components are handled:

  • planner = includes dependencies automatically in the target platform

  • slicer = does not include dependencies automatically in the target platform

For external libraries, prefer Maven locations.

1.3. Setting a target platform as active

Activating a target platform downloads the necessary JAR files, converts them into plug-ins if needed, and makes them available for development.

You can activate and switch the target platform in the Eclipse Preferences. Select Window  Preferences  Plug-in Development  Target Platform.

Alternatively, activate a target platform in the target definition editor via the Set as Active Target Platform link.

1.4. Update sites for Eclipse components

The Eclipse project offers update sites for different versions.

Use the following URL to develop against the latest release.

To develop against a specific release, use one of the following URLs.

1.5. Versions

You can define the desired version of a library via the version attribute, as demonstrated in the following example.

<unit id="org.eclipse.platform.feature.group" version="4.34.0.v20241120-1800"/>

To see the available versions, use code completion via Ctrl+Space in the version attribute. As of the 2024-12 release, the version attribute is optional and defaults to 0.0.0, which means that the latest available version is used. This allows you to change the URL to another release without having to update the individual versions.

2. Exercise: Create a target platform definition file

In this exercise, you create a target definition file to define the available libraries during development.

2.1. Create a general project

Create a new general project named target-platform via File  New  Other…​  General  Project.

New project wizard with the General Project entry selected
Project wizard page with the project name target-platform

2.2. Create a target definition file

Create a new target definition file via File  New  Other…​  Plug-in Development  Target Definition.

New wizard with the Target Definition entry selected

Use target-platform as the file name and press the Finish button.

New target definition wizard page with the file name target-platform

This creates a new file and opens the Target Definition editor.

2.3. Setting up a target platform for RCP or OSGi development

The following describes the definition of two target platforms. One for Eclipse IDE / RCP development and the other one for OSGi development.

2.4. Defining the target platform content for Eclipse RCP development

In this exercise, you add the Eclipse libraries for developing Eclipse RCP applications to your target definition.

Open your target definition file in the Target Definition editor and switch to its Source tab. Replace the content with the following text:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target-platform">
 <locations>
  <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
   <repository location="https://download.eclipse.org/releases/2026-09"/>
   <unit id="org.eclipse.equinox.sdk.feature.group"/>
   <unit id="org.eclipse.platform.feature.group"/>
  </location>
 </locations>
</target>

Save the target definition file.

The repository location points to an Eclipse update site (p2 repository) containing Eclipse plug-ins and features. The unit entries define the features you want to use from it. Maven repositories are not used in this example.

2.5. Exercise: Setting up a target platform for OSGi development

In this exercise, you create a target definition that can be used to develop OSGi-based command line applications.

2.5.1. Add content for OSGi development

Press the Add…​ button.

Add content to target definition file

Select Software site in the following dialog.

Depending on your installation, you may see different entries in the dialog, e.g., you may see an additional entry named Maven.

Add content to target definition file

Press the Next button and enter the following URL in the Work with selection box.

https://download.eclipse.org/releases/latest

https://download.eclipse.org/releases/latest points to the latest Eclipse release, you can select a specific release to build against.

Remove the Group by Category flag and add the following components:

Table 1. Target components
Component Description

Equinox Compendium SDK

Additional OSGi services

Equinox Core Function

Basis runtime and functionality of OSGi

Remove Group by

Save the target definition file.

2.6. Example solution for the target platform

If you check the content of the target platform via the Source tab, it should look similar to the following listing.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target-platform">
    <locations>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="https://download.eclipse.org/releases/latest"/>
            <unit id="org.eclipse.equinox.compendium.sdk.feature.group"/>
            <unit id="org.eclipse.equinox.core.feature.feature.group"/>
        </location>
    </locations>
</target>

2.7. Activating the target definition file

In the target file editor, select the Definition tab.

After the target is resolved, click the Set as Active Target Platform link to activate it.

Target Definition editor header with the Set as Active Target Platform link

After activation, the link changes to Reload Target Platform.

Target Definition editor header with the Reload Target Platform link
See Known issues with the target platform editor if the label does not change.

Avoid using the Eclipse IDE until the target is resolved and activated. Activating a target definition accesses the network. Interrupting this process may result in an inconsistent state of the target platform.

2.8. Known issues with the target platform editor

The target platform editor has some known issues, which are hard to reproduce and therefore not fixed yet.

  • Label does not change to Reload Target Platform after activation

  • You see an error similar to: An internal error occurred during: "Resolving "target-platform" target definition".

In both cases, close the target definition editor and restart your Eclipse IDE. Open the target definition file again and activate it again or verify that the status is correct.

If a newly added library from your target platform is not available in your projects, restart the IDE.

2.9. Optional: Checking the content of the target platform

Open the Bundle Repositories view via Window  Show View  Other…​  OSGi  Bundle Repositories. Use this view to review the available versions of the plug-ins in your target platform. The OSGi Resolution view shows details of the selected plug-in.

Bundle Repositories view and OSGi Resolution view for the selected plug-in

2.10. Solving potential issues with the target definition

Your target platform depends on external update sites and the availability of the network. These update sites might change over time, so keep the possibility to revert your target platform settings in case you face issues.

If you have problems accessing the network, you can temporarily use the Eclipse IDE as a target platform via Window  Preferences  Plug-in Development  Target Platform.

Target Platform preference page with the active target-platform definition and the Running Platform entry

3. Optional exercise: Mirroring p2 update

To avoid long running network operations to server outside the own network, you can mirror p2 update sites.

Mirroing with Tycho p2 explains how to mirror an update site with Maven.

One way is to use Eclipse to mirror a update site, for this you need to mirror the metadata and the artifacts.

The following is an example for Windows, which mirrors the latest update site to C:\Users\Lars\mirror.

Mirroring on Windows
./eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source https://download.eclipse.org/releases/latest -destination C:\Users\Lars\mirror

./eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source https://download.eclipse.org/releases/latest -destination C:\Users\Lars\mirror
Mirroring on Linux or Mac
./eclipse -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source https://download.eclipse.org/releases/latest -destination ~/mirror

./eclipse -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source https://download.eclipse.org/releases/latest -destination ~/mirror

This mirroring can run long. But it still can be useful to do this, as you could upload the mirrored artifacts on a server in your network. This will make the target definition resolution most likely faster for your developers.

After a successful run, you can change your target platform for the platform features to point to the mirrored p2 update site.

4. Learn more and get support

This tutorial continues on Eclipse RCP online training or Eclipse IDE extensions with lots of video material, additional exercises and much more content.

5. Target platform resources

Home Tutorials Training Consulting Books Company Contact us


Get more...