3
votes

I have a Vaadin application, which I'm trying to build as a set of OSGI bundles using Maven + BND.

I can't deploy the bundles To Apache Felix because some dependencies can't be resolved. Apache Felix complains that can't find package XYZ required by bundle "A", although this package is defined in this same bundle!!

I looked at the MANIFEST.MF file generated by Maven + BND and saw that the package (XYZ) from this bundle is added to both "import" and "export" sections. I understand why "export", but why "import"?? Why is the bundle trying to import its own package?

my MANIFEST.MF

Manifest-Version: 1.0
Export-Package: myexample.admin;uses:="com.vaadin.ui,myexample.webshared,
 com.vaadin.terminal,myexample.mvc.view.impl,
 myexample.mvc.model,myexample.mvc.renderer.map.impl,
 myexample.mvc.renderer,myexample.mvc.model.impl,myexample.util"
Built-By: ask
Tool: Bnd-0.0.384
Bundle-Name: admin
Created-By: 1.6.0_21 (Sun Microsystems Inc.)
Bundle-Version: 0
Build-Jdk: 1.6.0_26
Bnd-LastModified: 1315674240833
Bundle-ManifestVersion: 2
Import-Package: myexample.admin;version="1.0",myexample.mvc.model,
 myexample.mvc.model.impl,myexample.mvc.renderer,
 myexample.mvc.renderer.map.impl,myexample.mvc.view.impl,
 myexample.util,myexample.webshared,com.vaadin.terminal,com.vaadin.ui
Bundle-SymbolicName: admin
Include-Resource: ..\classes
Originally-Created-By: Apache Maven Bundle Plugin
2
Please post your BND settings (osgi.bnd file, relevant pom.xml parts).palacsint

2 Answers

7
votes

This is correct behaviour. The explanation is in section 3.5.6 of the OSGi core specification.

Regarding the unresolved error from Felix... this must be related to something else. Please post the actual error message.

2
votes

Niel is, of course correct. To be honest though, I've been very successful with using the noimports:=true to get around this. In my applications, I usually have the following in my maven-bundle-plugin section:

<Export-package>*;noimports:=true</export-package>

This results in all of your packages being exported into OSGi, and none of them will appear in your import-package section. If you only need a couple of your exported packages to not appear in your import-package section, you can set the noimports flag for each individual package. Lastly, this syntax is from BND, so it should also work in your .bnd files.