我正在从头开始编写用于Eclipse Smarthome的OSGi捆绑软件,并且需要导出某些软件包。这是必需的,因为此刻karaf控制台正在向我显示此错误:
Unresolved requirement: Import-Package: com.pubnub.api
在清单文件中,我可以看到我导入了相同的程序包。按照官方文档here,我使用maven导入了它。
OSGi开发人员支持告诉我,我必须“ 导出com.pubnub。API包,以便我的捆绑包将其导入”,但我不知道该怎么做。看来我应该“ 找到或制作一个导出PubNub API的捆绑软件”,但是这个答案使我感到困惑。
我想我需要在清单中的诸如“ export-package等”的地方添加一行,但是我不知道在哪个清单中,或者这是否是正确的方法。我是OSGi框架的初学者。
我曾尝试在类似的线程中进行搜索(例如this和this),但我认为它们对我的情况没有帮助。
这是我的清单文件,为清楚起见:
Import-Package: org.eclipse.smarthome.core.library.types, org.eclipse.smarthome.core.thing, org.eclipse.smarthome.core.thing.binding, org.eclipse.smarthome.core.types, com.google.gson;version="[2.8,3)", com.pubnub.api, com.pubnub.api.builder, com.pubnub.api.callbacks, com.pubnub.api.endpoints.pubsub, com.pubnub.api.models.consumer, com.pubnub.api.models.consumer.pubsub, com.pubnub.api.models.consumer.pubsub.message_actions, com.pubnub.api.models.consumer.pubsub.objects, org.slf4j;version="[1.7,2)"
这是我的pom:
<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.3-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.binding.safehome_se</artifactId>
<name>openHAB Add-ons :: Bundles :: SafeHome_SE Binding</name>
<dependencies>
<dependency>
<groupId>com.pubnub</groupId>
<artifactId>pubnub-gson</artifactId>
<version>4.31.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
您必须安装用于导出软件包的捆绑软件。您可以使用命令
从karaf命令行控制台安装它bundle:install mvn:<groupId>/<artifactId>/<version>