bundle 中未解决的约束 OSGI import package missing version number cannot import bundle

Unresolved constraint in bundle OSGI import package missing version number cannot import bundle

提前致谢。我在启动 osgi 包时遇到问题,它给出了以下错误消息: packages/bundles 不会安装。它编译并构建正常,当部署到 Karaf 时,它不会加载并抱怨缺少看起来正在导出和导入的接线包。但缺少版本 ID。

执行命令时出错:无法启动捆绑软件 mvn:com.ge.digital.passthru/passthrumt1.dataserviceimpl/1.0.1-SNAPSHOT in feature(s) passthru-mt1-application -1.0.1-SNAPSHOT:束中未解决的约束 passthrumt1.dataserviceimpl [298]:无法解决 298.0:缺少要求 [298.0] osgi.wiring.package; (osgi.wiring.package=com.ge.digital.passthru.dataservice)

Manifest 显示它正在导入包,并且正在导出,我唯一能找到的是导入包没有版本号。这是我的问题吗?任何想法如何解决?

Manifest-Version: 1.0
Bnd-LastModified: 1524070286656
Build-Jdk: 1.8.0_91
Built-By: 212555427
Bundle-ManifestVersion: 2
Bundle-Name: PassThru MT1 :: Data Service Impl
Bundle-SymbolicName: passthrumt1.dataserviceimpl
Bundle-Version: 1.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Service: com.ge.digital.passthru.dataservice.PDXDataService
Import-Package: com.ge.digital.passthru.dataservice,com.ge.digital.passt
 hru.entities;version="[1.0,2)",com.ge.digital.passtrhu.dataservice;vers
 ion="[1.0,2)",org.apache.camel;version="[2.17,3)",org.apache.camel.buil
 der;version="[2.17,3)",org.apache.camel.component.file;version="[2.17,3
 )",org.apache.camel.model;version="[2.17,3)",org.osgi.service.blueprint
 ;version="[1.0.0,2.0.0)",org.slf4j;version="[1.7,2)"
Tool: Bnd-1.50.0

这是我的 POM

<!-- GE Internal Dependencies -->
<dependency>
  <groupId>com.ge.digital.passthru</groupId>
  <artifactId>passthrumt1.dataservice</artifactId>
  <version>${project.version}</version>
</dependency>
<dependency>
  <groupId>com.ge.digital.passthru</groupId>
  <artifactId>passthrumt1.entities</artifactId>
  <version>${project.version}</version>
</dependency>

<!-- Fuse Dependencies -->
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-core</artifactId>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-blueprint</artifactId>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-ftp</artifactId>
</dependency>

<!-- logging -->
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
</dependency>

<plugins>

  <!-- to generate the MANIFEST-FILE of the bundle -->
  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>${bundle-plugin-version}</version>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
        <Private-Package>com.ge.digital.passthru.dataservice.impl.*</Private-Package>
        <Import-Package>
        com.ge.digital.passtrhu.dataservice,
        com.ge.digital.passthru.entities,
        *
        </Import-Package>
      </instructions>
    </configuration>
  </plugin>

</plugins>

我想这可以追溯到旧的 maven repo 使用 fuse 刷新东西,你需要删除 .m2/repository/xxx 目录和 fusehome/data 目录内容并重新开始。这解决了我的问题。感谢大家。希望这可以帮助。

现在一切看起来都很好。

    PassThru MT1 :: Data Service (297)
    ----------------------------------
    Created-By = Apache Maven Bundle Plugin
    Manifest-Version = 1.0
    Bnd-LastModified = 1524090455529
    Build-Jdk = 1.8.0_91
    Built-By = NSK1212555427A$
    Tool = Bnd-1.50.0

Bundle-ManifestVersion = 2
Bundle-SymbolicName = passthrumt1.dataservice
Bundle-Version = 1.0.1.SNAPSHOT
Bundle-Name = PassThru MT1 :: Data Service

Export-Package =
        com.ge.digital.passthru.dataservice;uses:=com.ge.digital.passthru.entities;version=1.0.1.SNAPSHOT
Import-Package =
        com.ge.digital.passthru.entities;version="[1.0,2)"


JBossFuse:admin@FLEET TEST ENV> headers 298

PassThru MT1 :: Data Service Impl (298)
---------------------------------------
Created-By = Apache Maven Bundle Plugin
Manifest-Version = 1.0
Bnd-LastModified = 1524090458281
Build-Jdk = 1.8.0_91
Built-By = NSK1212555427A$
Tool = Bnd-1.50.0

Bundle-ManifestVersion = 2
Bundle-SymbolicName = passthrumt1.dataserviceimpl
Bundle-Version = 1.0.1.SNAPSHOT
Bundle-Name = PassThru MT1 :: Data Service Impl

Export-Service =
        com.ge.digital.passthru.dataservice.PDXDataService

Import-Package =
        com.ge.digital.passthru.dataservice;version="[1.0,2)",
        com.ge.digital.passthru.entities;version="[1.0,2)",
        org.apache.camel;version="[2.17,3)",
        org.apache.camel.builder;version="[2.17,3)",
        org.apache.camel.component.file;version="[2.17,3)",
        org.apache.camel.model;version="[2.17,3)",
        org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
        org.slf4j;version="[1.7,2)"