maven - Maven (Tycho) 无法解析 OSGi 核心包
问题描述
我在我的 POM 中依赖于“org.osgi:osgi.core”(7.0.0)。原因是我需要访问“org.osgi.framework”包。我正在使用 Maven (3.6) 和 Tycho (1.5.1) 进行构建。构建平台运行 Debian 10 和 Java 11。
我收到以下错误:
Missing requirement: osgi.core 7.0.0.201802012106 requires 'osgi.unresolvable; (&(!(must.not.resolve=*))(must.not.resolve=*))' but it could not be found
但是,如果我删除依赖项,则会收到以下错误:
Missing requirement: my.bundle 0.0.0.qualifier requires 'java.package; org.osgi.framework 1.7.0' but it could not be found
出了什么问题?我该如何解决这个问题?
解决方案
I get the following error:
Missing requirement: osgi.core 7.0.0.201802012106 requires 'osgi.unresolvable; (&(!(must.not.resolve=*))(must.not.resolve=*))' but it could not be found
“companion jars”并不适用于运行时,因为解析是运行时操作(即使在构建期间执行,即用于部署目的)也不应包括在内(因此标有unresolvable
要求)。
However, if I remove the dependency I get the following error:
Missing requirement: my.bundle 0.0.0.qualifier requires 'java.package; org.osgi.framework 1.7.0' but it could not be found
这意味着您没有可用的运行时框架!添加对 equinox 框架的运行时依赖项(不是故意有偏见,但由于您使用的是 tycho,所以我假设 eclipse/equinox 环境。如果您有可用于 p2/tycho 的 Apache Felix 框架,那么如果您愿意,请使用它):
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.x.0</version>
<scope>runtime</scope>
</dependency>
// of course use tycho mechanism for above.
推荐阅读
- angular - AWS AppSync - 订阅握手期间出错
- python - 如何使用循环重新运行基本计算器
- wordpress - 在永久链接更改为 /%pagename%/ 后尝试打开帖子时收到 404 错误
- java - 项目反应堆中的异常处理问题以及重试失败的事务
- android - Android:SafetyNet 证明设备验证响应网络错误
- python - 如何解决这个超时异常,我想在我的命令行上打印文本
- go - 如何将引导样式应用于自动生成的表单
- javascript - 如何在 rxjs 上每 1 秒产生价值
- angular - 错误:无法匹配任何路由。URL 段:“标签”
- mongodb - MongoDB 统计相关集合中的数百万个文档