Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top