当前位置:  开发笔记 > 运维 > 正文

Maven:OSGI,捆绑和多模块项目

如何解决《Maven:OSGI,捆绑和多模块项目》经验,为你挑选了1个好方法。

我正在开发一个基于OSGi的应用程序(使用Equinox),试图对我在OSGi + Equinox上发现的网络教程进行编组.在这个项目中,有些捆绑包取决于其他捆绑(报价服务取决于报价).编译阶段确实成功,但封装阶段没有.Maven抱怨如下:

[INFO] [bundle:bundle]
[ERROR] Error building bundle de.vogella.osgi:quote-service:bundle:0.0.1 : Unresolved references to [de.vogella.osgi.quote] by class(es) on the Bundle-Classpath[Jar:dot]: [de/vogella/osgi/quoteservice/Activator.class, de/vogella/osgi/quoteservice/QuoteService.class]
[ERROR] Error(s) found in bundle configuration

我确实理解了这个问题,但是没有看到如何让它发挥作用.这是引用的pom:




    osgi-first-app
    de.vogella.osgi
    0.0.1


4.0.0
de.vogella.osgi
quote
bundle
Quote Bundle
0.0.1


    
        
            org.apache.felix
            maven-bundle-plugin
            1.4.3
            true
            
                
                    <_include>src/main/resources/META-INF/MANIFEST.MF
                
            
        
    


和报价的捆绑清单:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quote Plug-in
Bundle-SymbolicName: de.vogella.osgi.quote
Bundle-Activator: de.vogella.osgi.quote.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: de.vogella.osgi.quote

然后引用服务的pom:




    osgi-first-app
    de.vogella.osgi
    0.0.1



    
        de.vogella.osgi
        quote
        0.0.1
        bundle
    


4.0.0
de.vogella.osgi
quote-service
bundle
Quote Service Bundle
0.0.1


    
        
            org.apache.felix
            maven-bundle-plugin
            1.4.3
            true
            
                
                    <_include>src/main/resources/META-INF/MANIFEST.MF
                
            
        
    


最后报价服务的清单:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quoteservice Plug-in
Bundle-SymbolicName: de.vogella.osgi.quoteservice
Bundle-Activator: de.vogella.osgi.quoteservice.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0", \
 de.vogella.osgi.quote;version="0.0.1"

有什么不对 ?先感谢您 !



1> Patriarch24..:

答案很简单:我删除了已定义的清单,并在bundle插件指令中使用了bnd条目.这样可行 !

推荐阅读
雨天是最美
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有