Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling and running an OSGI application in Eclipse

The base of our enterprise application is OSGI and we have several Java projects that are logically OSGI bundles. We use Maven to compile the application using the Maven Bundle plugin. But this process is time consuming and makes it impossible to debug the application. We also use the Runner and Pax(:provison) plugins to run the application. If we could rely on the Auto build function of Eclipse and also debug the application it would make our lives so much easier. Is there a way to configure Eclipse to be able to compile (and may be run) an OSGI-based application?

like image 324
nosferat Avatar asked Aug 29 '12 14:08

nosferat


People also ask

How do I run OSGi?

Getting Started To run an OSGi bundle create a new OSGi run configuration and select the framework that you set up in the first step. Then add the bundles you want to run. The plugin will run all dependencies automatically, so you don't need to manually add them. Finally run the newly created run configuration.

How do I run OSGi bundle?

Procedure. Install the plug-in bundle into the Eclipse Equinox OSGi framework with the OSGi console. Start the Eclipse Equinox framework with the console enabled. Install the plug-in bundle in the Equinox console.

What is OSGi in eclipse?

The OSGi (Open Service Gateway Initiative) specification is a Java framework for developing and deploying modular software programs and libraries. The framework was originally managed by the OSGi Alliance, an open standards organization.

How do I debug OSGi bundle in Eclipse?

To run your bundles, right click and choose Run as ->OSGi Framework (or debug as). You can tweak which bundles are included in the runtime configuration, and what arguments are used. You may for example want to add -console . You can also create an application for export, which will give you a config.


1 Answers

I'm not entirely sure if I understand you, but here goes.

Well, running/debugging OSGi applications in Eclipse is really easy, as long as your bundles reside in PDE aware projects or at least are on your target platform.

Do you have the source of all your bundles? Debugging without source isn't all that useful. If you do, can you just import all the source of your bundles into your Eclipse workspace?

Otherwise you can create a target platform, add all your bundles to that. (as a first attempt, I'd say dump all your bundles in a directory and point the target platform there)

Either way, then you should be able to Run (or debug)-> OSGi framework -> New -> Pick your bundles -> Start

You can both pick bundles from or target platform and from your workspace.

like image 140
Frank Lee Avatar answered Nov 13 '22 08:11

Frank Lee