OSGI 运行时无法从我的本地存储库中提取依赖项

OSGI runtime cannot pull dependencies from my local repository

我正在开发一个 camel 项目,我正在尝试将该项目打包为 osgi 包并部署在使用 karaf 的 Fuse ESB 容器上。

POM 文件复制如下。

当我尝试 mvn install 时,我遇到了几个未解决的包错误。因此,我在 POM 中使用 'Import-Package' 将它们包含在清单条目中。这清除了错误并创建了包,但是当我尝试将它部署到保险丝容器上时,包停止并出现错误 Unable to resolve 257.0: missing requirement [257.0] osgi.wiring.package; (osgi.wiring.package=com.i2.cis.api.connector)

这是否意味着 osgi 运行时无法提取我本地 .m2 存储库中的这些 jar?

POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.abc.cde</groupId>
<artifactId>x2xx</artifactId>
<packaging>bundle</packaging>
<version>1.0.0</version>

<name>Test</name>
<url>http://www.example.com</url>

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  <camel.osgi.export.pkg />
  <camel.version>2.12.2</camel.version>
  <activemq.version>5.9.0</activemq.version>
  <java.version>1.7</java.version>
  <build.number>SNAPSHOT</build.number>
</properties>

<repositories>
    <!-- the cis libraries are present in this repo -->
    <repository>
        <id>repo</id>
        <name>test</name>
        <url>file:${project.basedir}/repo</url>
    </repository>
</repositories>

<dependencies>
  <!-- Start : CIS dependencies from local repo  -->
  <dependency>
      <groupId>cis</groupId>
      <artifactId>cis</artifactId>
      <version>8.2</version>
  </dependency>
  <dependency>
      <groupId>cis</groupId>
      <artifactId>cis-util</artifactId>
      <version>8.2</version>
  </dependency>
  <dependency>
      <groupId>cis</groupId>
      <artifactId>cis-sso-spi</artifactId>
      <version>8.2</version>
  </dependency>
  <dependency>
      <groupId>cis</groupId>
      <artifactId>connector-api</artifactId>
      <version>8.2</version>
  </dependency>
  <dependency>
      <groupId>cis</groupId>
      <artifactId>jdom</artifactId>
      <version>8.2</version>
  </dependency>
  <!-- End : CIS dependencies from local repo  -->

  <dependency>
      <groupId>xalan</groupId>
      <artifactId>xalan</artifactId>
      <version>2.7.2</version>
  </dependency>
  <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
      <version>2.11.0</version>
  </dependency>

  <!-- Start : Camel Jars -->
  <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>${camel.version}</version>
  </dependency>
  <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-spring</artifactId>
    <version>${camel.version}</version>
  </dependency>
  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-jms</artifactId>
      <version>${camel.version}</version>
  </dependency>
      <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-cache</artifactId>
      <version>${camel.version}</version>
      <!-- use the same version as your Camel core version -->
  </dependency>
  <!-- stream input -->
  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-stream</artifactId>
      <version>${camel.version}</version>
  </dependency>
  <!-- End : Camel Jars -->

  <!-- Start : Spring Jars -->
  <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>3.2.4.RELEASE</version>
  </dependency>
  <!-- End : Spring Jars -->

  <!-- Start : Testing Jars -->
  <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>14.0.1</version>
  </dependency>

  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test</artifactId>
      <version>${camel.version}</version>
      <scope>test</scope>
  </dependency>
  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test-spring</artifactId>
      <version>${camel.version}</version>
      <scope>test</scope>
  </dependency>

  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
  </dependency>

  <dependency>
      <groupId>de.theess.juxy</groupId>
      <artifactId>juxy</artifactId>
      <version>0.9.0</version>
      <scope>test</scope>
  </dependency>

  <dependency>
      <groupId>xmlunit</groupId>
      <artifactId>xmlunit</artifactId>
      <version>1.5</version>
      <scope>test</scope>
  </dependency>
  <!-- End : Testing Jars -->

  <!-- logging -->
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
  </dependency>
  <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.5</version>
  </dependency>
  <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
  </dependency>

  <!-- Start : Active MQ Jars-->
  <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-camel</artifactId>
      <version>${activemq.version}</version>
  </dependency>
  <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-pool</artifactId>
      <version>${activemq.version}</version>
  </dependency>
  <!-- End : Active MQ Jars-->

</dependencies>

<build>
  <defaultGoal>install</defaultGoal>
  <finalName>tma-1x</finalName>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.5.1</version>
      <configuration>
        <source>${java.version}</source>
        <target>${java.version}</target>
      </configuration>
    </plugin>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.5.2</version>
        <configuration>
            <check>
                <haltOnFailure>false</haltOnFailure>
            </check>
            <argLine>-XX:-UseSplitVerifier</argLine>
            <formats>
                <format>xml</format>
            </formats>
        </configuration>
        <executions>
            <execution>
                <phase>test</phase>
                <goals>
                    <goal>cobertura</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
            <execution>
                <id>copy-jaxb-index</id>
                <!-- here the phase you need -->
                <phase>compile</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <outputDirectory>target/classes/com/example/abc/bean</outputDirectory>
                    <resources>
                        <resource>
                            <directory>src/main/java/com/abc/cde/bean</directory>
                            <filtering>true</filtering>
                            <includes>
                                <include>jaxb.index</include>
                            </includes>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>

    <!-- allows the route to be ran via 'mvn camel:run' -->
    <plugin>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-maven-plugin</artifactId>
      <version>${camel.version}</version>
    </plugin>

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.5.4</version>
        <configuration>
            <effort>Max</effort>
            <threshold>Low</threshold>
            <xmlOutput>true</xmlOutput>
        </configuration>
        <executions>
            <execution>
                <phase>test</phase>
                <goals>
                    <goal>findbugs</goal>
                </goals>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </execution>
        </executions>
    </plugin>

    <!-- to generate the MANIFEST-FILE of the bundle -->
    <plugin>
      <groupId>org.apache.felix</groupId>
      <artifactId>maven-bundle-plugin</artifactId>
      <version>2.3.7</version>
      <extensions>true</extensions>
      <configuration>
        <instructions>
          <Bundle-SymbolicName>oo-test</Bundle-SymbolicName>
          <Private-Package>com.abc.cde.*</Private-Package>
          <Import-Package>
            com.xx.cis.api.connector, 
            com.xx.cis.connector.client, 
            javax.resource, 
            javax.resource.cci, 
            javax.xml.bind, 
            javax.xml.bind.annotation, 
            javax.xml.namespace, 
            org.apache.activemq, 
            org.apache.activemq.camel.component, 
            org.apache.activemq.pool, 
            org.apache.camel, 
            org.apache.camel.builder, 
            org.apache.camel.component.jms, 
            org.apache.camel.impl, 
            org.apache.camel.model, 
            org.apache.camel.processor.aggregate, 
            org.apache.camel.spi, 
            org.apache.camel.spring, 
            org.apache.camel.spring.spi, 
            org.apache.commons.pool, 
            org.apache.commons.pool.impl, 
            org.slf4j, 
            org.springframework.beans, 
            org.springframework.beans.factory.config, 
            org.springframework.context, 
            org.springframework.jms.connection, 
            org.w3c.dom
          </Import-Package>
        </instructions>
      </configuration>
    </plugin>
  </plugins>
</build>
<description></description>

错误是说您的包导入了包 com.i2.cis.api.connector 但没有包导出该包(在适当的版本),因此您的包无法解析。对于每个需求(例如包导入)必须有一个匹配的能力(例如包导出)。

您需要将所有必需的捆绑包与您自己的捆绑包一起安装。为此,Karaf 使用特征文件。您可能想为您的项目创建它。 有关使用 Karaf 进行正确配置的详细信息,请参见它的 documentation