使用 intelliJ IDEA 开发 OSGi

Developing OSGi using intelliJ IDEA

我正在学习使用intelliJ IDEA开发OSGi应用程序,我选择了Apache's felixApache的felix作为运行时,我遇到的问题如下: the screenshot is here

我已经开发了模块示例1、2和2b,2b的包结构和2一样,但是服务接口位于模块2,模块2b只是为了交替服务而设计的,但是我可以没有成功,felix 告诉我模块 2b 找不到 self.gale.services.DictionaryService,我不知道如何让模块 2b 可以找到在模块 2 的确切包中定义的服务。

I guess the problem is here

the start method of the Activator in module 2b:

public void start(BundleContext context)
{
    Hashtable<String, String> props = new Hashtable<>();
    props.put("Language", "French");
    context.registerService(
            DictionaryService.class.getName(), new DictionaryServiceImpl(), props);
}

the manifest property of module 2b Import-Package: org.osgi.framework,self.gale.services

我的意思是包 self.gale.services 位于模块 2,而不是这个 2b,但似乎找不到那个包。

您还需要提供 "self.gale.services" 在您的包“2”MANIFEST 文件的导出包中公开,并确保两个 MANIFEST 文件中 "self.gale.services" 的版本相互对应。