I want to build an OSGi compliant multi-moduled application where I have all the required bundles in 3 folders after compilation. I am using maven-bundle-plugin and maven-scr-plugin to create the bundles.
What I want is to run this application in an osgi container (Equinox) with a single command, using a script hopefully. For this I believe I have to create a config.ini file listing all the bundles in the application.
Is there a way to generate this at Maven compilation time itself? Or is there a better way to get all the bundles in some folder structure so that the app can be run straight away?
Just have a look at Tycho and its different packaging types (e.g. eclipse-application).
http://www.eclipse.org/tycho/
http://wiki.eclipse.org/Tycho/Packaging_Types
It is used for many commercial and open source applications.
You can use maven-pax-plugin with PaxRunner in your OSGi Maven project. Check this tutorial for the details.
<plugin>
<!-- Pax Runner Maven plugin -->
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.4</version>
<configuration>
<!-- Pax Runner version -->
<runner>1.4.0</runner>
<!-- OSGi framework type (equinox, felix, knopflerfish) -->
<framework>equinox</framework>
<provision>
<param>--log=debug</param>
<param>--workingDirectory=target/runner</param>
<!-- bundles that should be installed -->
<param>mvn:org.osgi/org.osgi.compendium/4.1.0@2</param>
<param>mvn:org.apache.felix/org.apache.felix.eventadmin/1.2.2@3</param>
<param>mvn:org.apache.felix/org.apache.felix.log/1.0.0@3</param>
</provision>
</configuration>
</plugin>
I wrote a maven plugin that by default creates a dist folder under target that contains a ready-to-use equinox with all maven dependencies. Equinox is wrapped with YAJSW so you can use the generated equinox package as a test server. Please see the plugin usage page: http://www.everit.org/eosgi-maven-plugin/
The documentation is a bit poor yet so in case you have any question please do not hesitate to ask.
A short step-by-step guide:
Edit:
A new cookbook will be available soon that contains a much more detailed step-by-step guide. The url is http://cookbook.everit.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With