使用 Felix & 创建完整的 OSGi 应用程序梅文

发布于 2025-01-05 22:36:49 字数 1102 浏览 3 评论 0原文

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

  1. 指定要包含在发行版中的捆绑包集和/或指定单个捆绑包并具有依赖关系已解决。
  2. 构建一个完整的分发框架。我的意思是一个包含所有需要的包的 zip 文件,加上 felix 的正确目录结构,以便用户可以简单地解压缩文件并输入“java -jar bin/felix.jar”。

我做了一些谷歌搜索,除了应用程序汇编器之外,我没有发现任何非常有前途的东西。你们中有人想出了一个好的解决方案吗?

更新 这是我想要实现的目标的说明。

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

其中 assemble-one 将包含 bundle-onebundle-two,而 assemble-two 将包含 bundle-twobundle-third 或其任意组合。然后,当您构建项目时,您将获得两个 zip 文件,一个用于 assemble-one,另一个用于 assemble-two,它们将在独立的文件中包含适当的包。费利克斯安装。例如:

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。

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. Specify the set of bundles to include in a distribution and/or specify a single bundle and have the dependencies resolved.
  2. Build a complete distribution of the framework. What I mean is a single zip file containing all the bundles needed, plus the correct directory structure for felix so that the user can simply unzip the file and type "java -jar bin/felix.jar".

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

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

A君 2025-01-12 22:36:49

Sling Launchpad 插件 [1] 创建一个可运行的 jar 文件或一个嵌入 OSGi 框架的 war 文件和一个可自定义的捆绑包列表,这可能就是您所需要的。这样,您甚至不必解压生成的 jar 文件,只需启动它就足够了。

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

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

べ繥欢鉨o。 2025-01-12 22:36:49

Fred 建议使用程序集插件来打包一个可以压缩的独立发行版,这是一个很好的建议。如果您正在寻找构建文件如何工作的示例,Apache Aries 博客示例源使用了 Maven 捆绑包和程序集插件。

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

我们在 Enterprise OSGi in Action (http://www.manning.com /enterpriseosgiinaction),或者快速谷歌搜索 eba、Virgo plan 或 karaf 功能应该会找到更多信息。您的用例的缺点是应用程序需要部署到运行时中,并预先安装适当的技术,因为没有一个是核心 OSGi。

另一个使部署更容易的项目是 Felix 文件安装。这允许您将捆绑包放入受监视的目录中,从而无需编写配置文件。

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.

心房敞 2025-01-12 22:36:49

也许这对您想要实现的目标有帮助?

我不确定,但也许值得一试?

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

也许还有以下内容?:

http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.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.

诗化ㄋ丶相逢 2025-01-12 22:36:49

如果您使用 OSGi v4+ 并使用 Maven 进行构建,请使用 pax-ops4j。它使用起来非常方便,使 OSGi 开发变得轻而易举。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文