首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用yang工具从yang文件生成Pojos失败

使用yang工具从yang文件生成Pojos失败
EN

Stack Overflow用户
提问于 2018-07-16 22:00:24
回答 0查看 457关注 0票数 1

根据这个guide,我正在尝试使用OpenDaylight从杨文件生成Pojos。我从OpenDaylight github克隆了Yangtools,并用mvn clean install构建了这个项目

我在我的pom中添加了以下内容:

代码语言:javascript
复制
<plugin>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-maven-plugin</artifactId>
           <version>2.0.8-SNAPSHOT</version>
           <executions>
               <execution>
                   <goals>
                       <goal>generate-sources</goal>
                   </goals>
                   <configuration>
                       <!-- directory containing yang files to parse and generate code -->
                       <yangFilesRootDir>src/main/yang</yangFilesRootDir>
                       <codeGenerators>
                           <generator>
                               <codeGeneratorClass>
                                   org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
                               </codeGeneratorClass>
                               <!-- directory into which generated files will be placed -->
                               <outputBaseDir>
                                   target/generated-sources
                               </outputBaseDir>
                           </generator>
                       </codeGenerators>
                       <!-- if true, plugin will search for yang files also in dependent projects -->
                       <inspectDependencies>true</inspectDependencies>
                   </configuration>
               </execution>
           </executions>
           <dependencies>
               <dependency>
                   <groupId>org.opendaylight.yangtools</groupId>
                   <artifactId>maven-sal-api-gen-plugin</artifactId>
                   <version>0.7.4-Lithium-SR4</version>
                   <type>jar</type>
               </dependency>
           </dependencies>
       </plugin>

然而,我无法生成源代码。我收到以下错误:

代码语言:javascript
复制
[ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:2.0.8-SNAPSHOT:generate-sources (default) on project odl-poc: Execution default of goal org.opendaylight.yangtools:yang-maven-plugin:2.0.8-SNAPSHOT:generate-sources failed: An API incompatibility was encountered while executing org.opendaylight.yangtools:yang-maven-plugin:2.0.8-SNAPSHOT:generate-sources: java.lang.AbstractMethodError: Method org/opendaylight/yangtools/maven/sal/api/gen/plugin/CodeGeneratorImpl.generateSources(Lorg/opendaylight/yangtools/yang/model/api/SchemaContext;Ljava/io/File;Ljava/util/Set;Ljava/util/function/Function;)Ljava/util/Collection; is abstract

我做错了什么?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51363650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档