将 OSGI 项目打包为单个 jar?
我有一个大型 OSGI 包,我想将其打包并发布为单个 jar 文件。我试图找出将多个罐子打包成一个大罐子的最佳方法。
到目前为止,我见过的最好的选择似乎是一罐项目。然而,我们使用的框架从“插件”目录中提取 jar 文件,并且 one-jar 似乎希望/要求所有 jar 文件仅存储在 lib 目录中。可能有一个简单的方法可以解决这个问题,我还没有充分了解架构,因为我仍在尝试确定哪种方法是最好的。
对于将多个 OSGI 包打包到一个 jar 中的其他方法的任何建议和/或我将如何使其在一个 jar 中工作,我们将不胜感激。
谢谢
I have a large OSGI package that I want to package and release as a single jar file. I'm trying to figure out what the best approach is for packaging multiple jars into a single large jar.
So far the best option I've seen appears to be one-jar project. However, the framework we are using pulls in jar files from a 'plugins' directory and one-jar appears to want/require all jar files to be stored only in the lib directory. There may be an easy way around this, I haven't looked fully into the architecture enough to know as I'm still trying to decide what approach is best.
any suggestions for other approaches to package the multiple OSGI bundles into one jar and/or how I would go about making it work in one-jar is appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另一种解决方案可能是使用 PojoSR 运行捆绑包,而不是在 OSGi 框架中运行它们。简而言之,PojoSR 实现了 OSGi 的服务层,没有模块层。其副作用之一是您可以轻松地将应用程序打包为可执行 JAR 文件。当您运行该 JAR 时,它也不需要在磁盘上创建捆绑包缓存。
有关 PojoSR 的详细信息,请访问:
An alternative solution could be to run your bundles using PojoSR instead of running them in an OSGi framework. PojoSR in a nutshell implements the service layer of OSGi without the module layer. One of the side effects of that is that you can easily package your application as an executable JAR file. When you run that JAR it also does not need to create a bundle cache on disk.
For more information on PojoSR, go to:
使用 Apache Felix Maven Bundle Plugin,我相信该选项可以满足您的需求。 http://felix.apache.org/site/apache -felix-maven-bundle-plugin-bnd.html
Using the Apache Felix Maven Bundle Plugin, I believe the option might accomplish what you are looking for. http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
Apache Sling 的 maven-launchpad-plugin 从捆绑包列表中生成可运行的 jar(以及可选的 war 文件和 Karaf 描述符),请参阅 http://sling.apache.org/site/maven-launchpad-plugin.html
Sling 安装程序可用于从文件系统加载其他包或其他来源,请参阅 http://sling.apache.org/ site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html
Apache Sling's maven-launchpad-plugin generates a runnable jar (and optionally a war file and a Karaf descriptor) from a list of bundles, see http://sling.apache.org/site/maven-launchpad-plugin.html
The Sling installer can be used to load additional bundles from the filesystem or other sources, see http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html