Creating a complete OSGi application with Felix & Maven

こ雲淡風輕ζ 提交于 2019-12-03 07:16:36
Holly Cummins

Fred's suggestion of using the assembly plugin to package up a self-contained distribution which can be zipped up is a good one. If you're looking for an example of how the build files for this would work, the Apache Aries blog sample source uses the maven bundle and assembly plugins.

Another approach is to create application artifacts. There isn't a single OSGi standard for this (yet), but several projects provide a way of grouping bundles together into super-bundles. This isn't quite like what you describe with your assemblies, since the OSGi framework isn't included, but it's similar to Eclipse feature.xmls. Have a look at Apache Aries eba (enterprise bundle archive) applications, Virgo plan files, or Karaf features. In most of these bundlings you get an archive which includes some bundles, and/or a metadata file which describes the application contents. Bundles which aren't included in the archive can be provisioned from a repository. For Aries, there is also an eba maven packaging which will generate the .eba archive containing the APPLICATION.MF file and included bundles.

We've got a bit more on this in Chapter 4 of Enterprise OSGi in Action (http://www.manning.com/enterpriseosgiinaction),or a quick google for eba, Virgo plan, or karaf feature should find you lots more. The downside for your use case is that the applications would need to be deployed into a runtime with the appropriate technology pre-installed into it, since none are core OSGi.

Another project to look at to make deploying easier is Felix file install. This allows you to drop bundles into a monitored directory, which saves having to write configuration files.

The Sling Launchpad Plugin [1] creates a runnable jar file or a war file that embeds the OSGi framework and a customizable list of bundles, that's probably what you need. With that you don't even have to unpack the generated jar file, just starting it is sufficient.

[1] http://sling.apache.org/site/maven-launchpad-plugin.html

Perhaps this can help for what you're trying to accomplish?

I don't know for sure but maybe it's worth a shot?

http://maven.apache.org/plugins/maven-assembly-plugin/

Also perhaps the following?:

http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

It will require a bit of reading/research but I think it might be useful. If not then maybe I don't correctly understand your goal and I am sorry.

If you are using OSGi v4+ and building with Maven, use pax-ops4j. It is very convenient to use and makes OSGi development a breeze.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!