<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>
    <parent>
        <groupId>com.github.frtu.archetype</groupId>
        <artifactId>base-pom</artifactId>
        <version>1.1.0</version>
    </parent>

    <groupId>com.github.frtu.governance</groupId>
    <artifactId>base-avro-pom</artifactId>
    <version>1.1.0</version>
    <packaging>pom</packaging>

    <name>Base Parent pom extension for Avro</name>
    <description>Base Parent pom extension for Avro</description>

    <properties>
        <!--===========================-->
        <avro.version>1.9.1</avro.version>
        <!--===========================-->
        <!--https://docs.confluent.io/current/clients/install.html?_ga=2.53151595.2105087684.1538406517-910848708.1535980058#installation-maven-->
        <confluent.maven.repo>https://packages.confluent.io/maven/</confluent.maven.repo>
        <confluent.version>5.0.0</confluent.version>
        <!--https://github.com/frtu/governance-toolbox#hortonworks-schema-registry-->
        <frtu.governance.version>1.1.0</frtu.governance.version>
        <frtu.lib.version>1.1.0</frtu.lib.version>
        <!--===========================-->
    </properties>
    <dependencyManagement>
        <dependencies>
            <!-- AVRO library -->
            <dependency>
                <groupId>org.apache.avro</groupId>
                <artifactId>avro</artifactId>
                <version>${avro.version}</version>
            </dependency>
            <!--LIBRARY-->
            <dependency>
                <groupId>com.github.frtu.governance</groupId>
                <artifactId>library-serdes</artifactId>
                <version>${frtu.lib.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.frtu.governance</groupId>
                <artifactId>library-kafka</artifactId>
                <version>${frtu.lib.version}</version>
            </dependency>

            <!-- Confluent Stack -->
            <dependency>
                <groupId>io.confluent</groupId>
                <artifactId>kafka-avro-serializer</artifactId>
                <version>${confluent.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>slf4j-log4j12</artifactId>
                        <groupId>org.slf4j</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>log4j</artifactId>
                        <groupId>log4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.confluent</groupId>
                <artifactId>kafka-schema-registry-client</artifactId>
                <version>${confluent.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>slf4j-log4j12</artifactId>
                        <groupId>org.slf4j</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>log4j</artifactId>
                        <groupId>log4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/avro/</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/target/generated-sources/</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <plugin>
                    <groupId>org.apache.avro</groupId>
                    <artifactId>avro-maven-plugin</artifactId>
                    <version>${avro.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>schema</goal>
                            </goals>
                            <configuration>
                                <sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
                                <outputDirectory>${basedir}/target/generated-sources/</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!--===========================-->
                <!--HORTONWORKS SCHEMA REGISTRY-->
                <plugin>
                    <groupId>com.github.frtu.governance</groupId>
                    <artifactId>schema-registries-maven-plugin</artifactId>
                    <version>${frtu.governance.version}</version>
                </plugin>
                <!--===========================-->
                <!-- CONFLUENT SCHEMA REGISTRY-->
                <!--https://docs.confluent.io/current/schema-registry/docs/maven-plugin.html-->
                <plugin>
                    <groupId>io.confluent</groupId>
                    <artifactId>kafka-schema-registry-maven-plugin</artifactId>
                    <version>${confluent.version}</version>
                    <dependencies>
                        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
                        <dependency>
                            <groupId>com.fasterxml.jackson.core</groupId>
                            <artifactId>jackson-databind</artifactId>
                            <version>${jackson-binding.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.avro</groupId>
                            <artifactId>avro</artifactId>
                            <version>${avro.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <!--===========================-->
            </plugins>
        </pluginManagement>
    </build>

    <repositories>
        <repository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>${confluent.maven.repo}</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>${confluent.maven.repo}</url>
        </pluginRepository>
    </pluginRepositories>
</project>