maven bundle plugin build error

拈花ヽ惹草 提交于 2019-12-25 05:45:08

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/32475209/maven-bundle-plugin-build-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!