Instructions in Export-Package that are never used

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.

7 thoughts on “Instructions in Export-Package that are never used

    1. 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.

  1. 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?

  2. 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 :/

  3. I fixed this problem by deleting the old generated sources in the repository directory. After new generation of sources, the build process was successfull.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s