小编isc*_*sco的帖子

两个依赖链 OSGI

我有以下错误:

在此输入图像描述

在文本中:

Error executing command: Error restarting bundles:
    Unable to start bundle 278: Uses constraint violation. Unable to resolve resource demo-persistence-jpa [demo-persistence-jpa [278](R 278.0)] because it is exposed to package 'javax.persistence' from resources javax.persistence [javax.persistence [248](R 248.0)] and org.apache.geronimo.specs.geronimo-jpa_2.0_spec [org.apache.geronimo.specs.geronimo-jpa_2.0_spec [266](R 266.0)] via two dependency chains.

Chain 1:
demo-persistence-jpa [demo-persistence-jpa [278](R 278.0)]

import: (&(osgi.wiring.package=javax.persistence)(version>=2.1.0))
 |
export: osgi.wiring.package: javax.persistence
javax.persistence [javax.persistence [248](R 248.0)]
Chain 2:
demo-persistence-jpa [demo-persistence-jpa [278](R 278.0)]
import: (osgi.wiring.package=org.hibernate.proxy)
 |
export: osgi.wiring.package=org.hibernate.proxy; uses:=javax.persistence
com.springsource.org.hibernate [com.springsource.org.hibernate [230](R   230.0)]
  import: (&(osgi.wiring.package=javax.persistence)(version>=1.0.0)(!(version>=2.0.0))) …
Run Code Online (Sandbox Code Playgroud)

java osgi hibernate jpa apache-servicemix

5
推荐指数
1
解决办法
4349
查看次数

在 OSGI 中嵌入传递依赖

我有一个OSGI依赖于第三方库的包,我不想将该库部署在容器中,我宁愿将其嵌入到我的包中。

当然,该库有它自己的依赖项,我也想嵌入它们。

我正在使用Maven Bundle Plugin

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
   <configuration>
     <instructions>
        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
        <Bundle-Description>${project.description}</Bundle-Description>
        <Bundle-Vendor>${bundle.vendor}</Bundle-Vendor>
        <Meta-Persistence>...</Meta-Persistence>
        <Export-Package>...</Export-Package>
        <Import-Package>...</Import-Package>
        <Embed-Dependency>3rd-Party</Embed-Dependency>                      
        <Embed-Transitive>true</Embed-Transitive>
      </instructions>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

因此,3rd-Party被嵌入到生成的包中,但不是其传递依赖项,就好像<Embed-Transitive>true</Embed-Transitive>没有任何效果一样。

所以我有一些问题

  • 这是以传递方式嵌入第三方库的正确方法吗?
  • 这是否会处理生成的清单文件(不导入属于第 3 方库及其依赖项的包)?

谢谢

java osgi maven maven-bundle-plugin

5
推荐指数
1
解决办法
5517
查看次数