Pax Exam: provisioning bundle with all dependencie

2019-07-31 11:51发布

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?

标签: pax-exam
1条回答
迷人小祖宗
2楼-- · 2019-07-31 12:39

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.

查看更多
登录 后发表回答