【问题标题】:Maven + ODL osgi.wiring.package javaxMaven + ODL osgi.wiring.package javax
【发布时间】:2015-06-29 03:36:01
【问题描述】:

我目前正在开发基于 OpenDaylight 的应用程序。我想使用 ObjectDB。

但我无法激活我的捆绑包。

opendaylight-user@root>bundle:diag
ntf-impl (171)
--------------
Status: Installed
Unsatisfied Requirements:
osgi.wiring.package; resolution:="mandatory"; filter:="(&(osgi.wiring.package=javax.jdo.annotations)(&(version>=3.1.0)(!(version>=4.0.0))))"
osgi.wiring.package; resolution:="mandatory"; filter:="(&(osgi.wiring.package=javax.persistence))"

在 mvn 全新安装期间

Unresolved constraint in bundle org.opendaylight.ntf.impl [205]: Unable to resolve 205.0: missing requirement [205.0] osgi.wiring.package; (&(osgi.wiring.package=javax.jdo.annotations)(version>=3.1.0)(!(version>=4.0.0)))

我会把我的 pom.xml 发给你

<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/xsd/maven-4.0.0.xsd">

  <parent>
    <groupId>org.opendaylight.controller</groupId>
    <artifactId>config-parent</artifactId>
    <version>0.3.0-SNAPSHOT</version>
    <relativePath/>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>org.opendaylight.ntf</groupId>
  <artifactId>ntf-impl</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>bundle</packaging>
  <repositories>
        <repository>
            <id>objectdb</id>
            <name>ObjectDB Repository</name>
            <url>http://m2.objectdb.com</url>
        </repository>
    </repositories>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>ntf-api</artifactId>
      <version>${project.version}</version>
    </dependency>
<dependency>
    <groupId>javax.jdo</groupId>
    <artifactId>jdo-api</artifactId>
    <version>3.1</version>
</dependency>
      <dependency>
    <groupId>javax.persistence</groupId>
    <artifactId>persistence-api</artifactId>
    <version>1.0.2</version>
</dependency>
    <dependency>
            <groupId>com.objectdb</groupId>
            <artifactId>objectdb</artifactId>
            <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>

我尝试了许多不同的依赖项。有没有人建议我如何让它运行?

【问题讨论】:

    标签: java maven dependencies karaf opendaylight


    【解决方案1】:

    确保将相关的捆绑包添加到功能内部的 features.xml 中,例如 features/src/main/features/features.xml。

    我遇到了 javax.jms 的包依赖错误,我通过在 features.xml 中添加包依赖项来修复它,如下所示。

      <feature name='odl-odlmq' version='${project.version}' description='OpenDaylight :: odlmq'>
    <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
    <feature version='${project.version}'>odl-odlmq-api</feature>
    <bundle>mvn:org.opendaylight.odlmq/odlmq-impl/${project.version}</bundle>
    <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bundle>
    <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
    </feature>
    

    类似地将 javax.jdo 的相关包添加到 features.xml 并再次构建。构建应该会成功并解决错误。

    或者,为了让它运行,您可以跳过测试进行构建。

    $ mvn clean install -DskipTests

    但是,在这种情况下,您必须稍后从 Karaf 手动安装依赖项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-10
      • 2021-02-16
      相关资源
      最近更新 更多