Maven 捆绑插件构建错误 [英] maven bundle plugin build error

查看:29
本文介绍了Maven 捆绑插件构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 mvn clean install 时,maven 抛出以下异常:

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

导出不在 Bundle-Classpath[Jar:dot] 上的包

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

我前几天可以成功构建,为什么会发生这种情况?

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

推荐答案

如果没有 POM 配置的详细信息,很难确定,但看起来您使用的是基于 bnd 的插件,这可能意味着 maven-bundle-pluginbnd-maven-plugin.

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.

在任何一种情况下,正在生成的包都导出了一个不在包中的包.这是破坏应用程序的可靠方法,因此 bnd 无法创建包.

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:

  • 有人在你的包中重命名了一个包,但没有更新 pom 文件中的导出
  • 有人从您的 pom 中删除了之前作为静态链接依赖项被拉入您的包中的依赖项
  • 有人重构了您正在使用的 SNAPSHOT,它不再包含您要导出的包
  • 有人已将 jar 文件嵌入到您的包中,但未将其添加到包类路径中.
  • 也有可能(但不太可能)有人将您的类配置为不进入包存档的根目录,因此类与 . 无关.

修复前三个问题很容易,要么修复包名称,要么重新添加正确的依赖项,或者删除导出.最后两个也很容易修复.您可以像这样更改您的包类路径:

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

另一个可能更好的选择是不将代码包含在嵌套的 JAR 文件中,而是将代码直接嵌入到您的包中.这意味着调整您的插件配置以使用嵌入语法.因为我不知道你在使用什么插件,所以我不能给你一个例子,但是 bnd 的包含资源的文档是 这里

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

这篇关于Maven 捆绑插件构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆