代码之家  ›  专栏  ›  技术社区  ›  Witold Kupś

OSGI-Java 8->9迁移(需要功能问题)

  •  2
  • Witold Kupś  · 技术社区  · 7 年前

    我正在尝试迁移我们的 bnd(OSGI) 从java 8到9的项目。第一次失败后,我已经准备好了基本项目。然而,我在java版本功能方面遇到了一些问题,例如bellow(只是其中的一部分,但与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))"
    

    首先,我所做的是更新所有依赖项,但没有帮助。 我在google上搜索了很多,但只得到了几个链接。 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 在中不可用 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 是我唯一的包裹。

    2 回复  |  直到 7 年前
        1
  •  3
  •   BJ Hargrave    7 年前

    Bnd 4.0尚未发布。所以它目前不在maven central。

    此外,您需要确保Felix框架的版本理解Java 9,并且能够正确地提供Java 9 ee。

        2
  •  2
  •   Witold Kupś    7 年前

    正如我在中提到的 a comment 我们对enroute 2.0有依赖性,它提供了旧版本的 org.eclipse.osgi . 手动更新到后 3.13 存在的问题 Require-capability 已经消失了。