如何使用eclipse和bndtools将jar转换为OSGi bundle [英] How to convert jar to OSGi bundle using eclipse and bndtools

查看:705
本文介绍了如何使用eclipse和bndtools将jar转换为OSGi bundle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个一步一步的指导,使用eclipse bndtools插件将jar转换为OSGi包。我知道可以使用命令行使用bnd,但是很高兴知道如何通过IDE执行相同操作。



我可能会丢失一些东西本教程仅解释如何从头开始创建项目。

解决方案

按照文章从标准jar创建Eclipse插件(OSGi软件包)实现这一点。 b
$ b

简而言之,您可以执行以下操作:


  1. 通过选择创建一个新的Plugin项目 File->新 - >项目...->插件开发 - > 现有JAR档案馆的插件


  2. 在这个新插件(捆绑)中选择你想拥有的jar。输入其他插件数据(名称,版本,ID等)。


  3. 取消选中标志将JAR存档解压缩到项目中。按下然后完成。

取消选中复选框将JAR存档解压缩到项目中 ,阻止从Jar中提取类文件,这通常不是必需的。



编辑:
要导出捆绑包以将其安装到OSGi运行时。选择您的捆绑包,然后选择文件 - >导出 - >插件开发 - > 可部署的插件和片段



取消选中导出来源的复选框。


I am looking for a step by step guide to convert jar into an OSGi bundle using the eclipse bndtools plugin. I know it is possible to do it with bnd using the command line but would be nice to know how to do the same via the IDE.

I might be missing something but this tutorial only explains how to create a project from scratch.

解决方案

Follow the article Create Eclipse plugins (OSGi bundles) from standard jar to achieve this. Though this approach does not use Bnd, but you would be able to achieve what you want.

In short you can do following:

  1. Create a new Plugin project by selection File-> New -> Project...-> Plug-in Development -> "Plug-in from Existing JAR Archives"

  2. Select jars you want to have in this new plugin(bundle). Enter other plugin data(name, version, id etc.).

  3. Uncheck the flag Unzip the JAR archive into the project. Press then finish.

Unchecking the checkbox Unzip the JAR archive into the project, prevents extracting class files from the Jar which is usually not necessary.

EDIT : To Export your bundle to install it into a OSGi runtime. Select your bundle and choose File -> Export -> Plug-in Development -> "Deployable plug-ins and fragment".

Uncheck the checkbox to Export source.

这篇关于如何使用eclipse和bndtools将jar转换为OSGi bundle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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