Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Import-Package in wired test plugin

Tomasz Belina November 14, 2013

I've notice that using <Import-Package> in <instructions> and <testInstructions> disables default imports calculated by amps plugin. I've tried to use * as default in <testInstructions> but it leads to importing strange packages (i.e. package; (package=org.apache.avalon.framework.logger)). In the end plugins system throws exception:

org.osgi.framework.BundleException: Unresolved constraint

Question is - is there any way to preserve default imports and specify only some additional packages to import ?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Dmitry_Zharikhin May 20, 2014

So, actually there's no default imports. It's just bnd work behind the scenes.

First, try to use <dependency> block with "test" or "provided" scope to include bundles in import-package block automatically - that's how bnd calculates dependencies. That's for troubleshooting.

Second, notice that, you have to place "*" ONLY AS LAST imported package. Or it will try to load everything before those you specified.

Third, use "resolution:=optional" if you are not shure about usage of package. It will avoid of failing when unnecessary package is unavailable. Look here

And the last,you can use negotiation to manually exclude unused packages from import.

Final example:

&lt;Import-Package&gt;org.foo.*,!org.foo.impl,*;resolution:=optional&lt;/Import-Package&gt;

Good luck!


TAGS
AUG Leaders

Atlassian Community Events