29Sep

Spring DM-OSGi Getting started

Am using STS as an IDE which is basically eclipse but preloaded with plugins to fit this kinda job! So I’ll be talking about it (every thing should work just fine on any other eclipse). To day I’ll talk on how to prepare the environment to start an Spring DM-OSGi project. we will start with creating a target-platform for the project, which means the set of jars that will be the backbone to run my project.

  • Open your IDE and make a new project by going to

File –> New –> Project…

new-project

we will use a plain project for the target-platform name it OSGi-Target and click finish.

osgi-target

  • Now we will extract the OSGi-Target JARs using Maven (a quick maven tutorial can be found here) I have prepared my pom file and you have to make sure to change the following tag with your own value:

<taget-platform.root>
/home/fadi/Programs/STS/workSpaces/OSGi-Series/OSGi-Target/target
</taget-platform.root>

create a new folder on the project and call it target

target-hir

Am using m2eclipse plugin for maven integration. to run the file Right click on the file:

Run as –> maven build…

in the goals field make sure to right package

screenshot-external-tools-configurations

Click run and maven will download and prepare your target folder you should see something like the following if every thing goes fine!

maven-build

Now refresh your target folder and you should see the newly installed JARs!

Now we need to make sure that STS/eclipse will run this platform when we make our first bundle!

  • Go to :

Window –> Preferences –> Plug-in Development –> Target Platform

change the location to match your target folder that you made earlier…

screenshot-preferences

click reload and you will see the 22 JARs in your target folder being displayed.

  • We can test our platform now by going to Run-configuration and creating new OSGi Framework, lets call it Target!

screenshot-run-configurations

click run and you will see that you have a warning on the console says that you don’t have a logging appenders declared(this is what we are going to fix in the next post), we can check our work by typing on the console “ss” which will give us the status of our Target:

screenshot-java-osgi-target-pomxml-springsource-tool-suite-1

That’s it for now and next post we will configure log4j using a fragment.

This is an on going Series and I hope to find some interested people who can help me in it :)

Posted in JAVA

Comments (0)

Leave a comment

You are commenting as guest.

Cancel Submitting comment...