Maven(Tycho)无法解析OSGi Core捆绑包

时间:2020-01-02 12:28:24

标签: maven osgi tycho

我在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

出了什么问题?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

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框架,那么您可以根据需要使用它):< / p>

<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.
相关问题