Difference between revisions of "Export Your OSGi Bundle"

From CDOT Wiki
Jump to: navigation, search
(Export)
(Export Your OSGi Bundle)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Export Your OSGi Bundle ==
 
== Export Your OSGi Bundle ==
 +
In this example, you'll export an OSGi bundle (as a JAR file) into a directory on your local file system. This bundle could then be installed and run in any OSGi-enabled container.
  
 +
NOTE: Yes, OSGi bundles are just JAR files. This means they can be used in the same way as any other JAR file. However, if an OSGi bundle (JAR) is deployed onto a non-OSGi enabled container, the OSGi meta data (inside MANIFEST.MF) will simply be ignored.
  
First,
+
First, start with the OSGi project you wish to bundle.
 
[[Image:bundle-1.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-1.png|left|thumb]]<br style="clear:left;" />
 
+
Check the manifest by viewing it in your editor.
 
[[Image:bundle-2.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-2.png|left|thumb]]<br style="clear:left;" />
 
+
Right click, then select Run As -> Run Configurations ...
 
[[Image:bundle-3.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-3.png|left|thumb]]<br style="clear:left;" />
 
+
Give your configuration a name, and deselect Target Platform - leaving only your project. Now click Apply followed by Run.
 
[[Image:bundle-4.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-4.png|left|thumb]]<br style="clear:left;" />
 
+
In the Console window you can see your bundle running.
 
[[Image:bundle-5.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-5.png|left|thumb]]<br style="clear:left;" />
 
+
Type 'ss' inside the Console window to see the ID of your bundle.
 
[[Image:bundle-6.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-6.png|left|thumb]]<br style="clear:left;" />
 
+
Use the 'stop' command to stop your bundle. Then click the red square just above the Console window to stop the execution environment.
 
[[Image:bundle-7.png|left|thumb]]<br style="clear:left;" />
 
[[Image:bundle-7.png|left|thumb]]<br style="clear:left;" />
 +
Now click on the File menu and select Export.
 +
[[Image:bundle-11.png|left|thumb]]<br style="clear:left;" />
 +
Select Plug-in Development -> Deployable plug-ins and fragments.
 +
[[Image:bundle-12.png|left|thumb]]<br style="clear:left;" />
 +
Select the project to export and give the directory name on your local file system that will hold your OSGi bundle. Then check the Options tab.
 +
[[Image:bundle-13.png|left|thumb]]<br style="clear:left;" />
 +
Uncheck Export Source (if necessary) and then click Finish.
 +
[[Image:bundle-14.png|left|thumb]]<br style="clear:left;" />
 +
Open a terminal window and verify that your bundle was saved.
 +
[[Image:bundle-15.png|left|thumb]]<br style="clear:left;" />
 
'''Congratulations!''' You've just exported your OSGi bundle onto your local file system.
 
'''Congratulations!''' You've just exported your OSGi bundle onto your local file system.

Latest revision as of 12:56, 30 January 2011

Export Your OSGi Bundle

In this example, you'll export an OSGi bundle (as a JAR file) into a directory on your local file system. This bundle could then be installed and run in any OSGi-enabled container.

NOTE: Yes, OSGi bundles are just JAR files. This means they can be used in the same way as any other JAR file. However, if an OSGi bundle (JAR) is deployed onto a non-OSGi enabled container, the OSGi meta data (inside MANIFEST.MF) will simply be ignored.

First, start with the OSGi project you wish to bundle.

Bundle-1.png

Check the manifest by viewing it in your editor.

Bundle-2.png

Right click, then select Run As -> Run Configurations ...

Bundle-3.png

Give your configuration a name, and deselect Target Platform - leaving only your project. Now click Apply followed by Run.

Bundle-4.png

In the Console window you can see your bundle running.

Bundle-5.png

Type 'ss' inside the Console window to see the ID of your bundle.

Bundle-6.png

Use the 'stop' command to stop your bundle. Then click the red square just above the Console window to stop the execution environment.

Bundle-7.png

Now click on the File menu and select Export.

Bundle-11.png

Select Plug-in Development -> Deployable plug-ins and fragments.

Bundle-12.png

Select the project to export and give the directory name on your local file system that will hold your OSGi bundle. Then check the Options tab.

Bundle-13.png

Uncheck Export Source (if necessary) and then click Finish.

Bundle-14.png

Open a terminal window and verify that your bundle was saved.

Bundle-15.png

Congratulations! You've just exported your OSGi bundle onto your local file system.