Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Integrating Felix inside Eclipse

This document explains how to launch Felix inside the Eclipse IDE. Then, it is possible to use Eclipse debugging facilities to debug bundles.

Preliminaries

To integrate Felix inside Eclipse, you need Felix, Eclipse and nothing else.

Installing Eclipse

First, you need Eclipse. To download the Eclipse IDE, go to:http://www.eclipse.org/downloads/. This tutorial works for Eclipse 3.X.X, but may works on older version.

Creation of the Felix binaries

Depending if you want to use the Felix release or the latest Felix revision (from the subversion repository), you have to donwload the Felix release or building the Felix trunk.

Downloading the Felix release

Once, Eclipse is installed, you need to download Felix. You will find this Felix release on http://cwikifelix.apache.org/FELIXsite/downloads.htmlcgi. Choose a binary release in your preferred archive format. Then, uncompress unzip the release in a temporary folder. We will copy the files elsewhere later.

Building Felix

If you want to use the Felix trunk, follows the instructions to checkou and build it. The Felix binaries are created in the main project. We will copy the files elsewhere later.

Installing Felix

The integration uses a Java project. This project will contain Felix. This section explains how-to create the new project, how-to copy the Felix release inside the project and finally, how-to configure it.

Creation of the Felix Java project

First, launch Eclipse, and select your preferred workspace. The integration will be attached to this workspace.

...


Figure 5: Our new Java Project

Copying Felix inside the created project

Now, remember where you uncompress the Felix release, or where is the Felix main project. Move these files inside the created project. Override the bin folder when asked.

...


Figure 7: The Felix project after the copy

Preparing the Felix project

The Felix classes are inside main jar is bin/Felix.jar. So, we need to add this jar in the project build path as presented on Figure 8. Right-click on the felix.jar file and then choose Build Path -> Add to Build Path.


Figure 8: Add the felix.jar file to the project build path

Run Felix

Create a Run configuration

Now, the Felix project is ready. But, we need to configure a Runconfiguration to launch Felix. To achieve this, right-click on the Felix project and select Run As -> Run... (Figure 9)

...


Figure 13: The Felix run configuration can be launched

First Execution

Once launched, you should see in the Eclipse console view:

...


Figure 15: Use the Felix console normally

Re-launching Felix

Once the run configuration for Felix is created (and launched a first time), you can launch Felix directly by clicking on the Run icon and by choosing Felix (Figure 16). Moreover, you can use Eclipse debugging features by launching Felix in debug mode. To achieve this, click on the debug icon and then choose Felix (Figure 17).

...


Figure 17: Launch Felix in debug mode

Felix Configuration

Obviously, you can modify the Felix configuration. The Felix configuration file is in the conf folder (config.properties). This section presents briefly two modifications. To go further, look at the Felix documentation.

Configure the Felix cache location

Felix store profiles and deployed bundle inside a cache. Normally this cache is located at_$user_home/.felix._ It is possible to change this location in order to clean it quickly.

...


Figure 19: The Felix cache inside your project

Add auto-started bundles

Often, you want that Felix deploy automatically some bundles. By modifying the felix.auto.start.1 (or 2), it is possible to configure which bundle will be deployed at startup.

...


Figure 20: Add auto-started bundles

Debugging bundles

Now that we are able to launch Felix as a Java Application, we can use the debugging and profiling features of Eclipse. To debug bundles, create a new project for your bundle. Then develop your bundle normally. Afterward, compile / package your bundle to obtain the bundle Jar file. You can use Eclipse PDE, Maven, BND, iPOJO, etc... to package your bundle.

To debug, your code, first place a breakpoint inside your code. Launch Felix in debug mode. Then deploy your bundle Jar file. When the execution reaches the breakpoint, Eclipse opens the debug perspective. You can use all debugging features normally.

Conclusion

This document has presented how-to integrate Felix inside Eclipse. For any question or feedback, feel free to send an email to clement.escoffier@gmail .com or on the Felix mailing list felix-dev@incubatorusers@felix.apache.org.