【问题标题】:Split Apache Avro Schemas in several files while having several goals in the avro-maven-plugin将 Apache Avro 模式拆分为多个文件,同时在 avro-maven-plugin 中有多个目标
【发布时间】:2019-03-28 09:53:36
【问题描述】:

我想拆分我的 avro 架构文件。为了生成源代码,我使用了 avro-maven-plugin。我关注了这个帖子:

Can I split an Apache Avro schema across multiple files?

它工作正常,但在我的情况下,我想要有不同的目标,然后我收到一条关于 [ERROR] Failed to execute goal org.apache.avro:avro-maven-plugin:1.8.2:protocol (schemas) on project AvroTestProject: Execution schemas of goal org.apache.avro:avro-maven-plugin:1.8.2:protocol failed: No protocol name specified: ... 的错误消息,因为我导入的文件只是一个架构而不是协议。

这是我的 pom.xml 的 sn-p:

        <plugin>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro-maven-plugin</artifactId>
            <version>${avro.version}</version>
            <executions>
                <execution>
                    <id>schemas</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>schema</goal>
                        <goal>protocol</goal>
                        <goal>idl-protocol</goal>
                    </goals>
                    <configuration>
                        <sourceDirectory>${project.basedir}/src/avro/</sourceDirectory>
                        <outputDirectory>${project.basedir}/src/</outputDirectory>
                        <imports>
                            <import>${project.basedir}/src/avro/TestSchema.avsc</import>
                        </imports>
                    </configuration>
                </execution>
            </executions>
        </plugin>

有没有办法只为某个目标声明导入?或者还有其他解决这个问题的方法吗?

【问题讨论】:

    标签: maven avro


    【解决方案1】:

    问题是您在avro-maven-plugin 中的目标定义。 因此,请考虑仅设置schema 目标以避免执行protocolidl-protocol,因为它与imports 块中的架构声明冲突。

    【讨论】:

      猜你喜欢
      • 2018-04-17
      • 2023-02-14
      • 2015-03-20
      • 1970-01-01
      • 2018-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多