BndTools,如何添加非OSGi JAR? [英] BndTools, How to add a non-OSGi JAR?

查看:125
本文介绍了BndTools,如何添加非OSGi JAR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BndTools,如何添加非OSGi JAR?我想将 jcraft 库添加到我的osgi项目中.使用纯JAR会破坏整个项目.缺少要求的接线包

BndTools, How to add a non-OSGi JAR? I wanted to add jcraft Libraries into my osgi project. Using plain JAR breaks the whole project. Missing requirement wiring package

ERROR: Bundle com.herle.iiot.application.installation [6] Error starting file:/D:/HERLE/Data/iot-sdk/FelixLauncher/bundle/com.herle.iiot.application.installation-1.5.0.jar
(org.osgi.framework.BundleException: Unable to resolve com.herle.iiot.application.installation [6](R 6.0): missing requirement [com.herle.iiot.application.installation [6](R 6.0)] osgi.w
iring.package; (osgi.wiring.package=com.jcraft.jzlib) Unresolved requirements: [[com.herle.iiot.application.installation [6](R 6.0)] osgi.wiring.package; (osgi.wiring.package=com.jcraft.jzlib)]
)
org.osgi.framework.BundleException: Unable to resolve com.herle.iiot.application.installation [6](R 6.0): missing requirement [com.herle.iiot.application.installation [6](R 6.0)] osgi.wi
ring.package; (osgi.wiring.package=com.jcraft.jzlib) Unresolved requirements: [[com.herle.iiot.application.installation [6](R 6.0)] osgi.wiring.package; (osgi.wiring.package=com.jcraft.jzlib)]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
        at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
        at java.lang.Thread.run(Unknown Source)
[Device Manager] info: Passive start
Watched path D:\HERLE\Data\iot-sdk\FelixLauncher\fileinstall key sun.nio.fs.WindowsWatchService$WindowsWatchKey@ae7c53
{felix.fileinstall.poll (ms) = 2000, felix.fileinstall.dir = D:\HERLE\Data\iot-sdk\FelixLauncher\.\fileinstall, felix.fileinstall.log.level = 4, felix.fileinstall.bundles.new.start = tru
e, felix.fileinstall.tmpdir = .\tmp, felix.fileinstall.filter = null, felix.fileinstall.start.level = 0}

请让我知道如何使用bnd.bnd配置文件来做到这一点?

Please let me know how can one do this using bnd.bnd config file?

推荐答案

主要要考虑的是配置.如果您使用的是外部库或jar,则需要将其作为私有软件包提及.

Main thing to consider is configuration. If you are using external library or jar then you need to mention it as private package.

请找到我的示例bnd.bnd文件.

please find my sample bnd.bnd file.

Bundle-Name: ${project.artifactId}
Bundle-SymbolicName: ${project.artifactId}
Bundle-Description: Template-Bundle for developing an application
Bundle-Category: Application
Bundle-Copyright: 2017 (c) Herleraja@gmail.com
-dsannotations: *
-metatypeannotations: *
Private-Package: \
    com.jcraft,\
    com.jcraft.jsch,\
    com.jcraft.jsch.jce,\
    com.jcraft.jsch.jcraft,\
    com.jcraft.jsch.jgss,\
    com.jcraft.jzlib

我建议您使用BndTools编辑bnd.bnd文件. 您可以从 BndTool安装中安装BndTools插件以使其日蚀.

I suggest you to use BndTools to edit the bnd.bnd file. you can install BndTools plugin to eclipse from BndTool Installation.

选择所需的软件包.

注意:由于它不会自动安装所有依赖项,因此如果需要任何额外的jar,则需要添加.即我想使用jsch,它依赖于jzlib.所以我在pom.xml文件中添加了这两个条目.

Note: Since it automatically does not install all the dependencies you need to add if any extra jars required. i.e I wanted to use jsch, which had a dependency on jzlib. So I added these two entries in pom.xml file.

<dependency>
    <groupId>com.jcraft</groupId>
    <artifactId>jsch</artifactId>
    <version>0.1.54</version>
</dependency>


<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>

希望这对您有所帮助!请投票,以便我可以写出更多解决方案.

Hope this helps some! Please vote so that i can write more solution.

这篇关于BndTools,如何添加非OSGi JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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