Problem
The Maven BND plugin does not add a package to the MANIFEST.MF of a bundle although the bundle is declared as exported package in the pom.xml
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${pom.version}</Bundle-Version>
<Import-Package>${module.importedPackages}</Import-Package>
<Export-Package>de.linnk.application</Export-Package>
<Service-Component>${module.serviceDefinitions}
</Service-Component>
<Embed-Dependency>${module.embeddedDependencies}
</Embed-Dependency>
<Embed-Directory>target/dependency</Embed-Directory>
</instructions>
</configuration>
</plugin>
Maven reports in the output:
[WARNING] Warning building bundle de.linnk.fatclient:lnFatClient:bundle:0.0.1-SNAPSHOT : Instructions in Export-Package that are never used: de\.linnk\.application
[WARNING] Warning building bundle de.linnk.fatclient:lnFatClient:bundle:0.0.1-SNAPSHOT : Superfluous export-package instructions: [de.linnk.application]
Solution
Double check if all bundles declared under “Export-Package” really exist in the bundle. In my case, the packaged specified under “Export-Package” did not exist in the bundle. This can, for instance, happen after refactoring package names and forgetting to update the package names in the manifest (Thanks, royp).
The warning messages here could really be a little bit more explicit.
So what should I do to get the bundle working !
I hope it will be as simple for you as for me. I declared a package which did not exist in the bundle under export-packages and was rewareded with this error message. Just fix/remove the faulty declarations in that case.
Forgot to say Thanks 🙂
You can also get this message if you refactor your bundle (i.e., symbolic name changes) but forget to update the package names to match. DAMHIKIJKOK?
hehe, absolutely! I added a little note above to hint at this! Thanks!
I just wanted to let you know that you gave me the last hint to completely understand that there is absolutely no help in refactoring with regards to the *.bnd files.
My solution: Delete the whole project and reimport it with a clean source
I fixed this problem by deleting the old generated sources in the repository directory. After new generation of sources, the build process was successfull.