OSGI - 处理捆绑包所需的第 3 方 JAR [英] OSGI - handling 3rd party JARs required by a bundle

查看:27
本文介绍了OSGI - 处理捆绑包所需的第 3 方 JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始进行 OSGI 开发,正在努力了解如何最好地处理依赖的 JAR.

I'm just getting started with OSGI development and am struggling to understand how best to handle dependant JARs.

即如果我正在创建一个包,很可能我需要使用一些 3rd 方 JAR.当我创建要部署到 OSGI 的包 JAR 时,显然这些 3rd 方 JAR 不包括在内,因此包将不会运行.

i.e. if I'm creating a bundle the likelyhood is that I will need to use a few 3rd party JARs. When I create my bundle JAR to deploy to OSGI, obviously these 3rd party JARs are not included and thus the bundle will not run.

我知道一种选择是将这些 JAR 转换为包并将它们部署到 OSGI 容器中.但是,如果它们只需要由一个包使用,这似乎并不理想.

I understand that one option is to turn these JARs into bundles and also deploy them to the OSGI container. However if they only need to be used by the one bundle this doesn't seem ideal.

对此的最佳解决方案是什么?JAR 可以嵌入到包 JAR 中吗?如果可以,这是一种合理的方法吗?

What is the best solution to this? Can the JARs be embedded within the bundle JAR and if so is this a reasonable approach?

推荐答案

我几乎总是将每个 jar 分开打包.OSGi 本身就是为了模块化,如果不这样做,整个系统就会变得很荒谬.

I would almost always bundle each jar separately. OSGi itself is meant for modularization and you take the whole system ad absurdum by not doing this.

如果您想将 JAR 转换为包,您可能需要使用 Peter Kriens 编写的 BND 工具.但首先,我建议您在 SpringSource Enterprise Bundle Repository 中查找捆绑包,如果他们还没有尚未为您完成工作.

If you want to convert JARs into bundles you might want to use the BND Tool written by Peter Kriens. But first I would suggest you look for the bundle in the SpringSource Enterprise Bundle Repository if they haven't already done the work for you.

这篇关于OSGI - 处理捆绑包所需的第 3 方 JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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