Dependency management in OSGI bundle ServiceMix

Hi I am new to ServiceMix, so probably I am asking same question which might be answered but I couldn't figure out.

My doubt is how do I manage compile time vs runtime dependencies when using bundle in ServiceMix OSGI. That is if I am building a .jar workable(by unit tests aleast) artifact with maven where all compile time dependencies say example(camel,spring) are handled by pom.xml dependencies and are loaded into jar as needed libs for successful build. So when I am deploying the jar in OSGI those libs(camel,spring) are already existing in maven generated jar. Now as OSGI bundles I am supporting same bundles(camel,spring) here during runtime from container.

So I am confused how or which copy of required dependency bundle my code picks for execution. Is it the one within .jar or the one provided by OSGI container. Though I am aware the MANIFEST file provides options, like Import Packages which help to import the dependencies from other OSGI bundles in container

May be I am missing some very key points of using OSGI here, so please correct me if I am wrong on any assumptions and provide some pointers/suggestions

Thanks


Looks like you're using the maven-bundle-plugin to generate your own bundle. In that case just make sure your dependencies for camel, etc. are of provided-scope instead of compile-scope

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <scope>provided</scope>
</dependency>

This will make sure your bundle only contains the dependencies it needs.

链接地址: http://www.djcxy.com/p/74760.html

上一篇: 尽管放置正确,但仍无法找到jstl

下一篇: OSGI捆绑包ServiceMix中的依赖关系管理