我有一个包含以下主要内容的捆绑包:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: HelloCamera
Bundle-SymbolicName: HelloCamera
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: hellocamera.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: cameraservice, cameraserviceimpl, org.osgi.framework
Layout:
HelloCamera
-> hellocamera
-> Activator.java
以及带有此清单的第二个捆绑包:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: CameraService
Bundle-SymbolicName: CameraService
Bundle-Version: 1.0.0.qualifier
Bundle-Localization: plugin
Export-Package: cameraservice, cameraserviceimpl
Import-Package: org.osgi.framework
Bundle-Activator: cameraserviceimpl.Activator
Layout:
CameraService
-> cameraservice
-> CameraService.java
-> cameraserviceimpl
-> Activator.java
-> CameraServiceImpl.java
我可以从 Eclipse 运行第一个包,一切正常。CameraService.jar
然后我将两个捆绑包HelloCamera.jar
分别导出为
我打开了我的 OSGI 控制台,java -jar equinox.jar -console
然后
osgi> install file:CameraService.jar
osgi> install file:HelloCamera.jar
osgi> ss
id State Bundle
17 INSTALLED HelloCamera_1.0.0.qualifier
18 RESOLVED unknown_0.0.0 [18]
然后我得到
The Bundle could not be resolved. Reason: Missing Constraint: Import-Package: cameraservice; version="0.0.0"