OpenDaylight Yangtools codeGeneratorClass for CodeGenerator 不能为空

OpenDaylight Yangtools codeGeneratorClass for CodeGenerator cannot be null

我可以使用 opendaylight yangtools 从 Yang 文件生成 Pojo。但是,在 mvn generate-sources 或 mvn clean build:

生成完成后,我不断收到此错误
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.816 s
[INFO] Finished at: 2018-07-22T10:09:59+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:2.0.8-SNAPSHOT:generate-sources (default) on project odl-yang-generator-poc: Execution default of goal org.opendaylight.yangtools:yang-maven-plugin:2.0.8-SNAPSHOT:generate-sources failed: codeGeneratorClass for CodeGenerator cannot be null

Caused by: java.lang.NullPointerException: codeGeneratorClass for CodeGenerator cannot be null
    at com.google.common.base.Preconditions.checkNotNull (Preconditions.java:900)
    at org.opendaylight.yangtools.yang2sources.plugin.ConfigArg$CodeGeneratorArg.check (ConfigArg.java:71)
    at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.instantiateGenerators (YangToSourcesProcessor.java:219)
    at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.conditionalExecute (YangToSourcesProcessor.java:135)
    at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesMojo.execute (YangToSourcesMojo.java:123)

这是我的 pom:

<parent>
        <groupId>org.opendaylight.mdsal</groupId>
        <artifactId>binding-parent</artifactId>
        <version>0.13.0-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <build>
    <plugins>
            <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>
                            <yangFilesRootDir>src/main/yang</yangFilesRootDir>
                                <codeGenerators>
                                <generator>
                                        org.opendaylight.mdsal.maven.sal.api.gen.plugin.CodeGeneratorImpl
                                    <outputBaseDir>
                                        target/generated-sources
                                    </outputBaseDir>
                                </generator>
                                </codeGenerators>
                            <inspectDependencies>true</inspectDependencies>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.opendaylight.mdsal</groupId>
                        <artifactId>maven-sal-api-gen-plugin</artifactId>
                        <version>0.13.0-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

很明显,生成文件后就找到了生成器。 是什么导致异常?

org.opendaylight.mdsal.maven.sal.api.gen.plugin.CodeGeneratorImpl 不正确 - 应该是 org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl.

但是你是从绑定父派生你的 pom,所以你根本不需要重新定义 yang-maven 插件,因为它已经是 defined/provided 绑定父。