如何在我自己的odl发行版中导入其他opendaylight项目

时间:2018-01-16 00:46:20

标签: pom.xml opendaylight

我正在尝试为Opendaylight创建自己的应用程序,因此对于我的应用程序,我将需要OpenFlowPlugin API中的一些函数。

使用mvn generate:archtype创建目录树后,我已经执行了mvn clean install并且运行良好,但当我尝试在“features /”目录中添加openflowplugin的新依赖项时(两个“功能”) /pom.xml“和”features / src / main / features / features.xml“)并重新执行mvn clean install我遇到了这个错误:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.opendaylight.odlparent.featuretest.SingleFeatureTest
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 97.286 sec <<< FAILURE! - in org.opendaylight.odlparent.featuretest.SingleFeatureTest
installFeature(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/kevin/agent/features/target/classes/features.xml, Feature: odl-agent-api 0.1.0-SNAPSHOT]  Time elapsed: 22.449 sec  <<< ERROR!
java.lang.IllegalArgumentException: Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
    at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:83)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:174)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:245)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:930)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:853)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:383)
    at Proxy803580f9_299a_4e75_9327_ceb8193fd94e.installFeature(Unknown Source)
    at org.opendaylight.odlparent.featuretest.SingleFeatureTest.installFeature(SingleFeatureTest.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

installFeature(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/kevin/agent/features/target/classes/features.xml, Feature: odl-agent 0.1.0-SNAPSHOT]  Time elapsed: 18.787 sec  <<< ERROR!
java.lang.IllegalArgumentException: Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
    at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:83)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:174)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:245)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:930)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:853)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:383)
    at Proxy93dd34dc_8bf7_4c49_b88e_434a37299c0c.installFeature(Unknown Source)
    at org.opendaylight.odlparent.featuretest.SingleFeatureTest.installFeature(SingleFeatureTest.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

installFeature(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/kevin/agent/features/target/classes/features.xml, Feature: odl-agent-rest 0.1.0-SNAPSHOT]  Time elapsed: 18.004 sec  <<< ERROR!
java.lang.IllegalArgumentException: Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
    at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:83)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:174)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:245)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:930)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:853)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:383)
    at Proxycb898a77_a151_4429_8e2d_c78b7f977d25.installFeature(Unknown Source)
    at org.opendaylight.odlparent.featuretest.SingleFeatureTest.installFeature(SingleFeatureTest.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

installFeature(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/kevin/agent/features/target/classes/features.xml, Feature: odl-agent-ui 0.1.0-SNAPSHOT]  Time elapsed: 18.952 sec  <<< ERROR!
java.lang.IllegalArgumentException: Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
    at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:83)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:174)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:245)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:930)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:853)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:383)
    at Proxyb9a3a1fb_f848_47c0_adb7_b80bd459aaa5.installFeature(Unknown Source)
    at org.opendaylight.odlparent.featuretest.SingleFeatureTest.installFeature(SingleFeatureTest.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

installFeature(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/kevin/agent/features/target/classes/features.xml, Feature: odl-agent-cli 0.1.0-SNAPSHOT]  Time elapsed: 18.844 sec  <<< ERROR!
java.lang.IllegalArgumentException: Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
    at org.apache.karaf.features.internal.FeatureValidationUtil.validate(FeatureValidationUtil.java:83)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.validateRepository(FeaturesServiceImpl.java:174)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.internalAddRepository(FeaturesServiceImpl.java:245)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:930)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.getFeatures(FeaturesServiceImpl.java:853)
    at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:383)
    at Proxy5ebdeace_2897_4ea2_970b_0d94758d35d7.installFeature(Unknown Source)
    at org.opendaylight.odlparent.featuretest.SingleFeatureTest.installFeature(SingleFeatureTest.java:340)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)


Results :

Tests in error: 
  Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
  Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
  Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
  Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features
  Unrecognized root element: {http://karaf.apache.org/xmlns/features/v1.4.0}features

Tests run: 5, Failures: 0, Errors: 5, Skipped: 0

以下是我编辑过的pom.xml和features.xml:

的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2017 Yoyodyne, Inc. and others. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
-->
<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">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.opendaylight.odlparent</groupId>
    <artifactId>features-parent</artifactId>
    <version>1.8.3-SNAPSHOT</version>
    <relativePath/>
  </parent>

  <groupId>org.opendaylight.agent</groupId>
  <artifactId>agent-features</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <!-- <name> formatting is used by autorelease to parse and notify projects on
       build failure. Please do not modify this unless you have a good reason. -->
  <name>ODL :: org.opendaylight.agent :: ${project.artifactId}</name>

  <properties>
    <mdsal.model.version>0.10.3-SNAPSHOT</mdsal.model.version>
    <mdsal.version>1.5.3-SNAPSHOT</mdsal.version>
    <restconf.version>1.5.3-SNAPSHOT</restconf.version>
    <yangtools.version>1.1.3-SNAPSHOT</yangtools.version>
    <dluxapps.version>0.5.3-SNAPSHOT</dluxapps.version>
    <openflowplugin.version>0.6.0-SNAPSHOT</openflowplugin.version>
    <configfile.directory>etc/opendaylight/karaf</configfile.directory>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- project specific dependencies -->
      <dependency>
        <groupId>org.opendaylight.controller</groupId>
        <artifactId>mdsal-artifacts</artifactId>
        <version>${mdsal.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.opendaylight.netconf</groupId>
        <artifactId>restconf-artifacts</artifactId>
        <version>${restconf.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.opendaylight.yangtools</groupId>
        <artifactId>yangtools-artifacts</artifactId>
        <version>${yangtools.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
    <groupId>org.opendaylight.openflowplugin</groupId>
    <artifactId>openflowplugin-artifacts</artifactId>
    <version>${openflowplugin.version}</version>
    <type>pom</type>
    <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.opendaylight.yangtools</groupId>
      <artifactId>features-yangtools</artifactId>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.mdsal.model</groupId>
      <artifactId>features-mdsal-model</artifactId>
      <version>${mdsal.model.version}</version>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.controller</groupId>
      <artifactId>features-mdsal</artifactId>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.netconf</groupId>
      <artifactId>features-restconf</artifactId>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.dluxapps</groupId>
      <artifactId>features-dluxapps</artifactId>
      <classifier>features</classifier>
      <version>${dluxapps.version}</version>
      <type>xml</type>
      <scope>runtime</scope>
    </dependency>
    <dependency>
    <groupId>org.opendaylight.openflowplugin</groupId>
    <artifactId>features-openflowplugin</artifactId>
    <classifier>features</classifier>
    <version>${openflowplugin.version}</version>
    <type>xml</type>
    <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>agent-impl</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>agent-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>agent-cli</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
</project>

FEATURES.XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
Copyright © 2017 Yoyodyne, Inc. and others. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<features name="odl-agent-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
  <repository>mvn:org.opendaylight.yangtools/features-yangtools/{{VERSION}}/xml/features</repository>
  <repository>mvn:org.opendaylight.controller/features-mdsal/{{VERSION}}/xml/features</repository>
  <repository>mvn:org.opendaylight.mdsal.model/features-mdsal-model/{{VERSION}}/xml/features</repository>
  <repository>mvn:org.opendaylight.netconf/features-restconf/{{VERSION}}/xml/features</repository>
  <repository>mvn:org.opendaylight.dluxapps/features-dluxapps/{{VERSION}}/xml/features</repository>
  <repository>mvn:org.opendaylight.openflowplugin/features-openflowplugin/{{VERSION}}/xml/features</repository>
  <feature name='odl-agent-api' version='${project.version}' description='OpenDaylight :: agent :: api'>
    <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
    <bundle>mvn:org.opendaylight.agent/agent-api/{{VERSION}}</bundle>
  </feature>
  <feature name='odl-agent' version='${project.version}' description='OpenDaylight :: agent'>
    <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
    <feature version='${project.version}'>odl-agent-api</feature>
    <bundle>mvn:org.opendaylight.agent/agent-impl/{{VERSION}}</bundle>
  </feature>
  <feature name='odl-agent-rest' version='${project.version}' description='OpenDaylight :: agent :: REST'>
    <feature version="${project.version}">odl-agent</feature>
    <feature version="${restconf.version}">odl-restconf</feature>
  </feature>
  <feature name='odl-agent-ui' version='${project.version}' description='OpenDaylight :: agent :: UI'>
    <feature version="${project.version}">odl-agent-rest</feature>
    <feature version="${restconf.version}">odl-mdsal-apidocs</feature>
    <feature version="${dluxapps.version}">odl-dluxapps-yangman</feature>
  </feature>
  <feature name='odl-agent-cli' version='${project.version}' description='OpenDaylight :: agent :: CLI'>
    <feature version="${project.version}">odl-agent</feature>
    <bundle>mvn:org.opendaylight.agent/agent-cli/{{VERSION}}</bundle>
  </feature>

</features>

我用来创建自己的odl发行版的完整命令是(我不知道它是否真的重要但是......):

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeVersion=1.3.3-SNAPSHOT -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/

有谁可以解释什么是错的?

1 个答案:

答案 0 :(得分:2)

请注意,错误表示命名空间 http://karaf.apache.org/xmlns/features/v1.4.0 ,这是针对在Opendaylight Nitrogen中引入的karaf 4.x.但是,您的功能xml具有名称空间 http://karaf.apache.org/xmlns/features/v1.2.0 ,表示您正在使用Opendaylight Carbon或更早版本。所以这意味着你从氮气中提取功能库(例如dluxapps或openflowplugin) - 在pom中确保为你正在使用的Opendaylight版本指定正确的dluxapps,openflowplugin等依赖版本(I假设碳)。