Alexey Romanov
Alexey Romanov

Reputation: 170919

Pax Exam: provisioning bundle with all dependencies

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?

Upvotes: 1

Views: 474

Answers (1)

Harald Wellmann
Harald Wellmann

Reputation: 12885

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.

Upvotes: 1

Related Questions