Harold L. Brown
Harold L. Brown

Reputation: 9946

How to convert an .avsc Avro schema file into an .avdl Avro schema file as part of a Maven build?

How can I convert an .avsc Avro schema file into an .avdl Avro schema file as part of a Maven build?

Upvotes: 0

Views: 1108

Answers (1)

Harold L. Brown
Harold L. Brown

Reputation: 9946

One can convert .avdl Avro schema files into .avsc Avro schema files by leveraging the Maven exec-maven-plugin plugin:

<profile>
    <id>avsc</id>
    <dependencies>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro-tools</artifactId>
            <version>${avro-tools.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>avsc-generation</id>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.apache.avro.tool.Main</mainClass>
                    <arguments>
                        <argument>idl2schemata</argument>
                        <!-- path to input .avdl file -->
                        <argument>path/to/AvdlFile.avdl</argument>
                        <!-- path to output directory -->
                        <argument>path/to/output-directory</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

Upvotes: 1

Related Questions