Pax Exam: provisioning bundle with all dependencies

梦想与她 提交于 2019-12-24 12:22:03

问题


Currently, to set up configuration for Pax Exam, I find that I need to include all dependencies. E.g. something like

@Configuration
public Option[] сonfig() {
    MavenArtifactProvisionOption commonsDbcp = mavenBundle("commons-dbcp",
            "commons-dbcp");
    MavenArtifactProvisionOption commonsPool = mavenBundle("commons-pool",
            "commons-pool");
    ...
    return options(
            felix(),
            provision(commonsDbcp, commonsPool));
}

But since commons-dbcp depends on commons-pool, this feels like duplicate information. Is it possible for Pax Exam to figure out that commons-dbcp is needed without adding it explicitly?


回答1:


Not really...

  • Not every Maven dependency of an OSGi bundle is an OSGi bundle.
  • A dependency may be an interface-only, and at run-time, you want to provision an implementation bundle instead.

Listing all bundles explicitly is the only safe way of provisioning your framework. At least, you can use the versionAsInPom() option method to avoid duplicating the artifact versions.



来源:https://stackoverflow.com/questions/10312102/pax-exam-provisioning-bundle-with-all-dependencies

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!