I'm developing my application as a set of OSGi bundles using Maven 2. Some common functionality, such as logging, web server etc. is used from other OSGi bundles, for example, I'm using the OSGi version of Jetty.
I want to ship my application with all third-party bundles and an OSGi container included. I chose Apache Felix as my default container.
I'm quite new to Maven and I don't know how to write the POM file that does this and couldn't find a similar example in the Maven book. The core point seems to be that a multi-module project doesn't create an artifact of its own.
It does build and package my bundles into OSGI-compatible JAR files as it should (using the maven-bundle-plugin). Now I want it to wrap up the other stuff as well (which doesn't need to be built or anything, just pulled in and put into the package) and produce a ZIP file like this:
+-Archive Root
|
+- /bundles
|
+- my.bundle1.jar
+- my.bundle2.jar
+- 3rd.party.bundle1.jar
+- 3rd.party.bundle2.jar
+- /conf
|
+- ... some config files ...
+- felix.jar
That way, my user can download the ZIP file, unpack it to a directory, say "MyApp", and then go
# > java -jar /path/to/MyApp/felix.jar
Some notes on details, if they matter:
- Each bundle is a child of a common parent project that has no own source code and a
packaging
set to "pom", as taken from the book's examples. - I have decided against enbedding Felix into a central bundle ("hosted framework" approach)
- I might offer an alternative shipping that just includes my own bundles for customers running OSGi containers. This might be a starting point?