0

When I run mvn clean install, maven throws the following exception:

Exporting packages that are not on the Bundle-Classpath[Jar:dot]

I could build successfully a few days ago, why is it happenning?

Koby Douek
  • 16,156
  • 19
  • 74
  • 103
xierui
  • 1,047
  • 1
  • 9
  • 22
  • Since answering this I see that the original question [here](http://stackoverflow.com/questions/32458371/osgi-bundle-compile-error) has much more information. It would be helpful not to ask the same question twice with radically different amounts of information in it! – Tim Ward Sep 09 '15 at 11:02

1 Answers1

0

It's hard to be certain without details of your POM configuration, but it looks like you're using a bnd based plugin, which probably means the maven-bundle-plugin or the bnd-maven-plugin.

In either case the bundle that's being produced is exporting a package which is not in the bundle. This is a sure-fire way to break your application, and so bnd is failing the bundle creation.

At a guess (because I don't have much information to go on) one of the following has happened:

  • Somebody has renamed a package in your bundle but not updated the export in the pom file
  • Somebody has removed a dependency from your pom that was previously being pulled into your bundle as a statically linked dependency
  • Somebody refactored a SNAPSHOT that you were using and it no longer contains the package you wanted to export
  • Somebody has embedded a jar file into your bundle, but not added it to the bundle classpath.
  • It is also possible (but less likely) that someone has configured your classes not to go into the root of the bundle archive, so classes are not relative to ..

Fixing the first three issues is easy, either fix the package name, re-add the right dependency, or remove the export. The last two are also fairly easy to fix. You can change your bundle classpath like this:

Bundle-ClassPath: /path/to/my.jar, /path/to/another.jar, /path/to/folder

Another, probably better, option is not to include the code in a nested JAR file, but instead to embed the code directly in your bundle. This would mean adjusting your plugin configuration to use embedding syntax. As I don't know what plugin you're using I can't give you an example, but the documentation for bnd's include resource is here

Tim Ward
  • 1,169
  • 8
  • 9