<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>ch.admin.bit.jeap</groupId>
        <artifactId>jeap-messaging</artifactId>
        <version>13.8.0</version>
    </parent>

    <artifactId>jeap-messaging-avro</artifactId>
    <name>${project.groupId}:${project.artifactId}</name>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jeap-messaging-model</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.admin.bit.jeap.messaging.test.messagetype.jme</groupId>
            <artifactId>jme-declaration-created-event</artifactId>
            <version>1.4.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.admin.bit.jeap.jme.messagetype.jme</groupId>
            <artifactId>jme-test-created-event</artifactId>
            <version>0.0.4</version>
            <scope>test</scope>
        </dependency>

        <!-- build plugin first -->
        <dependency>
            <groupId>ch.admin.bit.jeap</groupId>
            <artifactId>jeap-messaging-avro-maven-plugin</artifactId>
            <type>maven-plugin</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/avro</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>${project.groupId}</groupId>
                <artifactId>jeap-messaging-avro-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>idl</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>idl</goal>
                            <goal>schema</goal>
                            <goal>protocol</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
                            <sourceDirectory>${project.basedir}/src/test/resources</sourceDirectory>
                            <outputDirectory>${project.build.directory}/generated-test-sources</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <deleteBaseEventFiles>false</deleteBaseEventFiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.6.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-test-sources/</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
