我正在尝试将我们的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))"首先,我所做的就是更新所有的依赖项--但是没有帮助。我搜索了很多,但只有几个链接的结果。与问题最接近的就是那个没有帮助思考--我添加了以下几行代码,但没有结果:
run.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"也许升级我的available插件会有帮助,但是在自述文件上提到的版本(我目前正在使用3.5)在mavenCentral中是不可用的。
我的项目规范- 基本示例回购
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中运行项目,可能会出现问题--至少我们没有处理好运行我们的主要项目。
任何帮助都将不胜感激,如果需要的话,我会尽力为您提供更多的信息。
更新
即使当我删除几乎所有依赖项(清洗过的树枝)时,在启动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是我唯一的包。
发布于 2018-04-19 08:10:24
正如我在评论中提到的那样,我们将代理路由2.0,它提供了org.eclipse.osgi的旧版本。在手动更新3.13之后,Require-capability的问题就消失了。
发布于 2018-04-17 15:05:54
Bnd 4.0尚未发布。因此,它目前不在maven中心。
另外,您需要确保Felix框架的版本理解Java 9,并能够正确地提供Java 9 ee。
https://stackoverflow.com/questions/49877329
复制相似问题