java-8 - OSGI - Java 8 -> 9 迁移(需求能力问题)

标签 java-8 osgi java-9 bndtools

我正在尝试迁移我们的 bnd(OSGI)从java 8到9的项目。第一次失败后我已经准备好了基本项目。但是,我陷入了java版本功能的问题,就像下面这样(只是其中的一部分,但与java版本的差异都是相同的):

! Failed to start bundle org.apache.felix.gogo.command-1.0.2, exception 

Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

org.osgi.framework.BundleException: Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

首先我所做的是更新所有依赖项 - 但没有帮助。 我用谷歌搜索了很多,但只得到了几个链接。 The one这是最接近问题的,但无济于事 - 我添加了以下几行,但没有结果:

运行.bndrun

Bundle-RequiredExecutionEnvironment: JavaSE-9
Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9"

也许升级我的 bnd gradle 插件会有所帮助,但是 readme 提到的版本(我当前使用 3.5)(4.0)在 mavenCentral 中不可用。

我的项目规范 - basic example repo

Eclipse Oxygen.3a Release (4.7.3a)
Bndtools 3.5.0.REL
Java 9.0.4+11
OSGI 6.0
Gradle 4.4
Gradle bnd plugin - 3.5

顺便说一句:如果您尝试在 Intellij 中运行项目,可能会出现问题 - 至少我们无法应对运行我们的主项目。

任何帮助将不胜感激,如果需要,我会尽力为您提供更多信息。

更新

即使我删除了几乎所有依赖项 (cleaned branch) ,启动后 run.bndrun 我仅收到

could not resolve the bundles: [project.main-1.0.0.201804171613 org.osgi.framework.BundleException: Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

]

Failed to start bundle project.main-1.0.0.201804171613, exception Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

project.main 是我唯一的包。

最佳答案

Bnd 4.0 尚未发布。所以它目前不在 Maven Central 中。

此外,您还需要确保 Felix 框架的版本支持 Java 9 并能够正确提供 Java 9 ee。

关于java-8 - OSGI - Java 8 -> 9 迁移(需求能力问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49877329/

相关文章:

spring - 是否建议在 Apache Karaf 上运行 Spring 4 应用程序?

annotations - 使用 ResourceChangeListener AEM 6.3 处理事件

java - 是否可以导入两个具有相同包的 jar ?

java - Java 9 可以在 32 位操作系统上运行吗?

Java 8 Function<String, Void> 与 Consumer<String>

java - 如何通过Java程序启动JavaDB?

lambda - 为什么 forEach 循环内的变量不应更改?

java - 如何解释 Java 8 和 Java 7 中 HashMap 的插入性能

osgi - 将 Swagger 2.0 与 Glassfish 4.1 OSGi REST 项目集成

java - ServiceLoader 真的动态加载提供者吗?