Showcase of using a maven repository as a Schema Repository.
Join the discussion on Gitter:
The examples here are built and published to:
Demonstrates:
-
Compose data models using maven dependency framework. Leverage maven to compose and re-use, version, release and publish avro data models. (see: test-schema depend-on test-schema-common)
-
Validate avro schemas (extensile). (documentation, compatibility with previously released versions, deprecation prrior to removal)
-
Add a unique ID to the schemas (mvnId = "group:artifact:version:id")
-
Generate and publish java classes. (publishing for other languages can se set up) (@Immmutable support, @Nullable/@Nonnull) see
-
Generate package and publish the avro schemas, see.
-
Generate and publish avrodoc to maven repo or gh-pages.
More schema project examples: https://github.com/zolyfarkas/core-schema
The pom file for a schema project is as simple as (see example from this repo for more detail):
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.spf4j.avro.examples</groupId>
<artifactId>test-schema</artifactId>
<packaging>jar</packaging>
<version>1.5-SNAPSHOT</version>
<name>${project.artifactId}-${project.version}</name>
<description>Avro schema example</description>
<parent>
<groupId>org.spf4j.avro</groupId>
<artifactId>schema-parent-pom</artifactId>
<version>LATEST</version>
</parent>
<properties>
<avro.version>LATEST</avro.version> <!-- change to use your own fork or official -->
<avro.allowUndefinedLogicalTypes>false</avro.allowUndefinedLogicalTypes>
</properties>
<dependencies>
<dependency> <!-- this schema will re-use schema's from this dependency -->
<groupId>org.spf4j.avro.examples</groupId>
<artifactId>test-schema-common</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
</project>
The bulk of the functionality is implemented using: