使用Felix& amp;创建一个完整的OSGi应用程序Maven的 [英] Creating a complete OSGi application with Felix & Maven

查看:193
本文介绍了使用Felix& amp;创建一个完整的OSGi应用程序Maven的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组使用Maven构建的OSGi包,我想知道是否有可用的Maven插件允许我执行以下操作:

I have a set of OSGi bundles being built using Maven and I was wondering if there is a Maven plugin available that allows me to do the following:


  1. 指定要包含在分发中的捆绑包和/或指定单个捆绑包并解析依赖关系。

  2. 构建框架的完整分发。我的意思是一个包含所有所需包的zip文件,以及felix的正确目录结构,这样用户只需解压缩文件并输入java -jar bin / felix.jar。

我做了一些谷歌搜索,除了appassembler我没有找到任何有希望的东西。你有没有想过一个好的解决方案?

I did some Googling and I didn't find anything very promising aside from appassembler. Have any of you ever come up with a good solution?

更新
这里是我想要完成的一个例子。

Update Here's an illustration of what I'm trying to accomplish.

example-parent\
               bundle-one
               bundle-two
               bundle-three
               assembly-one
               assembly-two

其中 assembly-one 将包括 bundle-one bundle-two assembly-two 将包括 bundle-two bundle-three 或任何其组合。然后,在构建项目时,您将获得两个zip文件,一个用于 assembly-one ,另一个用于 assembly-two 在自包含的felix安装中包含相应的包。例如:

Where assembly-one would include bundle-one and bundle-two and assembly-two would include bundle-two and bundle-three or any combination thereof. Then when you build your project, you would get two zip files, one for assembly-one and one for assembly-two that would contain the appropriate bundles in a self-contained felix install. For example:

assembly-one.zip\
                 bin\felix.jar
                 bundle\bundle-one, bundle-two, plus bare min felix bundles
                 conf\any configuration files I need

希望能提供更多有关我正在努力实现的信息。我想这有点类似于Eclipse如何使用feature.xml,但当然不使用Eclipse。

Hopefully that provides a little more information about what I'm trying to accomplish. I guess this is kind of similar to how Eclipse does a feature.xml, but of course not using Eclipse.

推荐答案

Fred的建议使用程序集插件打包一个可以压缩的自包含分发是一个很好的。如果您正在寻找一个如何构建文件的示例,Apache Aries博客示例源使用maven包和汇编插件。

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.

另一种方法是创建应用程序工件。目前还没有一个OSGi标准(但是),但有几个项目提供了一种将捆绑在一起组成超级捆绑的方法。这与您使用程序集描述的内容不太相似,因为OSGi框架不包含在内,但它与Eclipse feature.xmls类似。查看Apache Aries eba(企业捆绑存档)应用程序,Virgo计划文件或Karaf功能。在大多数这些捆绑中,您将获得一个存档,其中包含一些包和/或描述应用程序内容的元数据文件。可以从存储库中配置未包含在存档中的分发包。对于Aries,还有一个eba maven包装,它将生成包含APPLICATION.MF文件和包含的包的.eba存档。

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.

我们有更多关于这在Enterprise OSGi in Action的第4章( http://www.manning.com/enterpriseosgiinaction )中,或快速谷歌eba,处女座计划,或karaf功能应该找到你更多。您的用例的缺点是需要将应用程序部署到运行时,并在其中预先安装适当的技术,因为没有一个是核心OSGi。

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.

另一个可以看到使部署更容易的项目是Felix文件安装。这允许您将捆绑包拖放到受监视的目录中,这样可以节省写入配置文件的时间。

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.

这篇关于使用Felix& amp;创建一个完整的OSGi应用程序Maven的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆