Eclipse Feature Support in bnd 7.5.0: From Build Paths to Running Eclipse Applications

bnd 7.5.0 makes Eclipse features usable as dependencies on the build path and as requirements for runtime resolution. You can select an Eclipse feature, inspect its contents in Bndtools, and use the bundles it groups together without maintaining the entire list by hand.

The workspace template fragments complement this support: the eclipse fragments configure Eclipse repositories, while the eclipse-apps fragments provide examples ranging from a headless Equinox application to an Eclipse 4 application with SWTBot tests.

This walkthrough starts with feature support itself, then covers the repository fragments and the application examples. The examples below use Eclipse Platform 4.41 and Java 21 or newer.

Contents

  1. Eclipse features in bnd 7.5.0
  2. Using features on the build path
  3. Using features at runtime
  4. Preconfigured Eclipse repository fragments
  5. Eclipse application fragments
  6. Getting started and further reading

1. Eclipse features in bnd 7.5.0

An Eclipse feature groups plug-ins and can include other features. bnd represents a feature as a repository resource with the identity type org.eclipse.update.feature. Both a P2 repository and an OSGi repository reading an index generated by the P2 repository can expose these resources.

In the Bndtools Repositories view, expand a feature and its version to inspect included features, included bundles, and required features or bundles. The hierarchy distinguishes the feature’s members from its dependencies. Selecting an entry also lets you inspect its capabilities and requirements in the Resolution view.

The Show Eclipse Features toolbar toggle controls feature visibility, including advanced search results. Hiding features only changes the view; it does not change the repository, build path, or resolver inputs.

A feature and a bundle can have the same ID and version. Use type=org.eclipse.update.feature when selecting the feature explicitly. Without that attribute, a container-path entry is treated as a bundle.

Here, workspace template fragment means a reusable piece of workspace configuration. This is separate from an OSGi fragment bundle, such as a platform-specific SWT fragment.

2. Using features on the build path

Add a feature to a project’s bnd.bnd using the normal build-path syntax and the feature type:

-buildpath: \
    org.eclipse.e4.rcp;type=org.eclipse.update.feature

bnd expands this entry to the feature’s member bundles. It follows the <plugin> entries in feature.xml and recursively expands features referenced by <includes>. Imports under <requires> describe dependencies rather than members, so they are not expanded as part of this operation.

The Eclipse 4 application template uses this directly, alongside the Jakarta APIs used by its application code:

-buildpath: \
    jakarta.inject.jakarta.inject-api;version='2.0',\
    jakarta.annotation-api;version='3.0',\
    org.eclipse.e4.rcp;type=org.eclipse.update.feature

Feature entries use an exact feature ID; wildcards are not supported. Add a version attribute when you want to select a particular feature version. The versions pinned for members in the feature are resolved exactly. If a pinned bundle version is unavailable, bnd uses the highest available version and reports a warning.

Platform selection applies here too. Set osgi.os, osgi.ws, and osgi.arch in the project’s -runproperties to target a specific platform. Unspecified values default to the platform running bnd. Feature members whose platform attributes do not match are skipped.

The same feature-entry syntax also works on -testpath, -runpath, and -runbundles. For runtime dependency resolution, use a feature requirement as described next.

Allowing updates up to the next major feature version

Use an OSGi version range to accept the current feature version and later versions while excluding the next major version. The supplied Eclipse Platform 4.41 index contains org.eclipse.e4.rcp version 4.41.0.v20260819-1952, so the corresponding range is [4.41.0.v20260819-1952,5.0.0).

On the build path:

-buildpath: \
    org.eclipse.e4.rcp;\
        version='[4.41.0.v20260819-1952,5.0.0)';\
        type=org.eclipse.update.feature

The same range syntax works on the run path:

-runpath: \
    org.eclipse.e4.rcp;\
        version='[4.41.0.v20260819-1952,5.0.0)';\
        type=org.eclipse.update.feature

The opening [ includes the current version; the closing ) excludes 5.0.0 and every later version. Quote the range because its comma is part of the attribute value. These are feature versions, independent of the bnd release version. Use the version shown for the feature in your chosen repository as the lower bound, and the next feature major version as the exclusive upper bound.

For a lower bound covering every qualified build of the 4.41.0 release, use [4.41.0,5.0.0) instead. Keeping the full qualifier as above also excludes earlier qualified builds of that release. The range constrains feature selection; the selected feature still supplies its own member-bundle versions. Only versions present in the configured repositories are available, so accepting a range does not by itself add a newer Eclipse repository.

To keep both paths aligned, define the range once in shared configuration:

eclipse.rcp.feature.range: [4.41.0.v20260819-1952,5.0.0)

-buildpath: \
    org.eclipse.e4.rcp;version='${eclipse.rcp.feature.range}';type=org.eclipse.update.feature

-runpath: \
    org.eclipse.e4.rcp;version='${eclipse.rcp.feature.range}';type=org.eclipse.update.feature

Choose each path according to its purpose: -buildpath supplies compilation dependencies, while -runpath puts the expanded JARs on the launched VM’s class path. To have the resolver select and install the feature’s bundles into the OSGi runtime, use -runrequires as described below.

3. Using features at runtime

To let the resolver select the bundles of a feature, put the feature in -runrequires:

-runrequires: \
    bnd.identity;id=org.eclipse.e4.rcp;type=org.eclipse.update.feature

-runproperties: \
    osgi.os=win32,\
    osgi.ws=win32,\
    osgi.arch=x86_64

The resolver follows the feature’s plug-in members and included features, then resolves the bundle dependencies needed for the runtime. This differs from putting a feature on -buildpath, where the feature is expanded to construct the compilation path.

Eclipse features often cover several operating systems and architectures. The target platform determines which SWT and launcher fragments participate in resolution. bnd matches platform attributes on feature members and the supported platform constraints from bundle Eclipse-PlatformFilter headers. You no longer need to blacklist the bundles for all the other platforms just to resolve a feature for your target.

If you omit a target value, bnd uses the host platform, with the window system following the operating system. The application templates provide separate launch files for their supported targets, so you can select the appropriate file instead of editing these properties for every launch.

In Bndtools, open the .bndrun, click Resolve, save the result, and choose Run As > Bnd OSGi Run Launcher. Adding a feature to the build path and resolving a runtime are separate steps: the build path supplies compilation dependencies, while the run configuration describes the application you want to execute.

Older P2 indexes need the metadata used by feature expansion and platform selection. Refresh them through the P2 repository implementation before reusing them as indexed OSGi repositories. The feature hierarchy uses index metadata, so browsing it does not require downloading each feature JAR.

4. Preconfigured Eclipse repository fragments

The Eclipse repository fragments configure the repositories that supply the features and bundles. Select them in the Bndtools workspace wizard.

There are two families:

Fragment Repository contents Example
Eclipse Platform The Eclipse Platform update site eclipse_4.41_platform
Eclipse SimRel The broader Eclipse Simultaneous Release repository eclipse_4.41_simrel_2026-09

Choose Platform for the Eclipse application examples below. Choose SimRel when you need projects distributed through the simultaneous release beyond the Platform itself.

Each repository fragment adds its configuration under cnf/ext. For example, the Platform 4.41 fragment supplies eclipse_4.41_platform.bnd and its pre-generated index.

P2 access and indexed OSGi access

Each fragment defines two ways to access the same repository: the P2 repository implementation reads the update site and generates an index, while the OSGi repository implementation reads that generated index. A release-specific selector activates one of them:

# Read the supplied index using OSGiRepository
indexed.ecl-4.41 = true

Set it to false to activate P2 access when generating or refreshing the index. The matching SimRel selector is indexed.ecl-2026-09.

Using the index avoids reconstructing the repository index from the remote P2 site during workspace setup. Bundle artifacts are still downloaded when required; the index is repository metadata, not an offline copy of every bundle.

To set up the bnd command, follow the official bnd CLI installation instructions, then check your installation with bnd version. Use bnd 7.5.0 for the examples in this article. The installation guide explains how to run the executable JAR and make it available as the bnd command.

For a repository update, switch the relevant selector to false, run the following command from the workspace root (the directory containing cnf), and check the generated index:

bnd repo refresh

Commit the generated *_p2.index.xml.gz beside its configuration and switch the selector back to true. Other developers and CI can then use the same committed index. The repository cache under build/cache is local generated data and should stay out of source control.

Release-specific property names allow several Platform or SimRel versions to coexist in a workspace. Each repository has its own selector. Older release fragments are also listed in the template index as archived entries.

5. Eclipse application fragments

The Eclipse application fragments show how these pieces work together. Each application declares the Platform 4.41 fragment as a template dependency; the SWTBot test fragment also depends on the Eclipse 4 application fragment.

Use Java 21 or newer and build the generated projects before resolving their launch files. The fragments supply repository configuration for the published org.bndtools.applaunch application launcher through Maven Central. The SWTBot fragment additionally registers its P2 repository.

Wizard entry Project Example
Eclipse RCP Headless example.rcp.headless An Equinox application with console output
Eclipse RCP SWT example.rcp.ui An SWT/JFace progress dialog
Eclipse RCP E4 Application example.rcp.app.ui An Eclipse 4 product with an application model, handlers, and CSS
Eclipse RCP SWTBot Tests example.rcp.app.ui.swtbot.tests UI tests for the Eclipse 4 application

Adding and using the fragments in Bndtools

Open File > New > Other… > Bndtools > Bnd Workspace (Fragments). To add examples to the workspace already open in Eclipse, select Update current Eclipse workspace. For a new workspace, clear that option and choose its location instead. Enter Eclipse* in the filter to find the Eclipse application and repository fragments.

Selecting the E4 application and SWTBot test fragments in Bndtools. The Requires column identifies their template dependencies.

Click Finish to apply the selected fragments and their dependencies, then wait for the generated projects to appear in Bndtools Explorer and finish building. The common workflow for the application projects is:

  1. Expand the application project in Bndtools Explorer and open its .bndrun for your operating system and architecture.
  2. Select the editor’s Run tab and click Resolve to calculate the runtime bundles. Review the resolve result and save the configuration.
  3. Right-click that same .bndrun and select Run As > Bnd OSGi Run Launcher. For SWTBot, select Run As > Bnd OSGi Test Launcher (JUnit) instead.
  4. Use Eclipse’s Console view for application output and the JUnit view for test results. The Source tab shows the instructions behind the editor settings.

The UI screenshots below use the installed Bndtools 7.6-SNAPSHOT interface; the example configurations and CLI validation use bnd 7.5.0.

A headless Equinox application

Start with Eclipse RCP Headless for a small application without a graphical interface. Its entry point implements IApplication, prints a timestamped message, and returns IApplication.EXIT_OK.

Open headless.bndrun, resolve, save, and launch it. The run configuration selects example.rcp.headless.application through eclipse.application.

Open headless.bndrun from Bndtools Explorer. Its Source tab shows the application entry point, requirements, and resolved bundles; switch to Run to resolve and launch it.

Its console output looks like this:

RCP headless app launched at 2026.11.23-09:25:22!

An SWT and JFace application

Eclipse RCP SWT adds a small graphical example. It opens a JFace progress dialog, reports progress for three seconds, and exits.

For Windows x86-64, open ui_win32.win32.x86-64.bndrun. The shared configuration requires the org.eclipse.e4.rcp feature, the application bundle, and the application launcher. Resolve, save, and launch it as above.

A JFace progress dialog launched from a bnd run configuration.

The UI examples include launch configurations for Windows x86-64, Linux GTK x86-64, and macOS Cocoa x86-64 and aarch64. The macOS configurations include -XstartOnFirstThread. Files ending in _shared.bndrun provide common configuration for these launch files and are not standalone launch targets.

An Eclipse 4 application

Eclipse RCP E4 Application provides a product with an application model, dependency injection, command handlers, and CSS styling. Its Sample Part shows five items and an input field; editing the field marks the part as dirty, and the save handler clears that state.

This example connects the two feature use cases: its bnd.bnd uses the Eclipse RCP feature on the build path, and its shared run configuration selects the feature for runtime resolution:

The E4 project’s bnd.bnd in Bndtools. Select Source to inspect the feature entry or Build to work with the build-path editor.

-runrequires: \
    bnd.identity;id=org.bndtools.applaunch,\
    bnd.identity;id=org.eclipse.e4.rcp;type=org.eclipse.update.feature,\
    bnd.identity;id=example.rcp.app.ui

The product is selected through eclipse.product=example.rcp.app.ui.product. On Windows x86-64, resolve and launch app.ui_win32.win32.x86-64.bndrun.

The shared E4 runtime configuration in Bndtools. Inspect common requirements here, then open the platform-specific .bndrun to resolve and launch the application.

The Eclipse 4 application combines an application model, handlers, and CSS with a runtime resolved from an Eclipse feature.

Testing the application with SWTBot

Eclipse RCP SWTBot Tests adds tests for the Eclipse 4 application. The tests check that the main window appears, the Sample Part contains five items, and the application can quit without platform errors.

Build both the application and test projects. Open the matching swtbot_*.bndrun, click Resolve, save, and select Run As > Bnd OSGi Test Launcher (JUnit). The configuration uses separate runtime storage and runs the tests on a background thread so that SWT retains the main thread for its event loop.

The SWTBot project’s shared configuration shows the tester, test-thread setting, and additional requirements. Launch the matching platform-specific file with the JUnit test launcher and inspect the JUnit view afterward.

The repository also contains a fragment testbed that creates clean workspaces, installs fragments, builds projects, resolves run configurations, and launches examples. Use --keep-all to retain successful workspaces for inspection or screenshots.

Running the examples from the bnd CLI

The examples can also be built and launched from the command line. After installing the application fragments into a workspace, the following sequence builds, resolves, and launches the E4 example on Windows x86-64:

cd example.rcp.app.ui
bnd build
bnd resolve resolve -W app.ui_win32.win32.x86-64.bndrun
bnd run app.ui_win32.win32.x86-64.bndrun

For automated checks across the Eclipse application fragments, run the repository’s testbed from its root:

bash testbed/testbed.sh --bnd 7.5.0 \
  --fragment eclipse-apps__headless \
  --fragment eclipse-apps__ui \
  --fragment eclipse-apps__app-ui \
  --fragment eclipse-apps__swtbot-tests \
  --keep-all

The testbed writes a REPORT.md with links to individual build, resolve, and launch logs. It resolves the supplied target configurations and launches those matching the host. The SWTBot example also contains application screenshot routines, so UI captures can be produced by a CLI test run.

For CLI SWTBot runs, the template revision used here needs a small test-startup correction: the test must wait for the application’s existing main-thread Display. Calling Display.getDefault() on the background test thread too early can create the display on the wrong thread and cause Invalid thread access. The screenshot run uses that correction in its separate test workspace.

6. Getting started and further reading

For a first try, select Eclipse RCP E4 Application in the workspace wizard, which also brings in its Platform repository dependency. Build the project, open the launch file matching your operating system and architecture, resolve, save, and run. Then compare the feature entry in bnd.bnd with the feature requirement in the shared .bndrun.

The same workflow gives you a starting point for your own Eclipse application: select the features you need, use them for compilation and runtime resolution, and keep the repository configuration and indexes with the workspace.

Which Eclipse features or application examples would you like to see supported by additional workspace fragments?