<?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">
    <parent>
        <artifactId>schema-registry-plugins</artifactId>
        <groupId>io.confluent</groupId>
        <version>8.2.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>schema-importer</artifactId>

    <properties>
        <tink.version>1.15.0</tink.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
            <version>2.19.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-registry</artifactId>
            <version>${io.confluent.schema-registry.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>

        <dependency>
            <groupId>com.netflix.governator</groupId>
            <artifactId>governator-core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.crypto.tink</groupId>
            <artifactId>tink</artifactId>
            <version>${tink.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-serializer</artifactId>
            <version>${io.confluent.schema-registry.version}</version>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-registry</artifactId>
            <classifier>tests</classifier>
            <version>${io.confluent.schema-registry.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_${kafka.scala.version}</artifactId>
            <classifier>test</classifier>
            <version>${ce.kafka.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.confluent.cloud</groupId>
                    <artifactId>events-schema</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.confluent.networking</groupId>
                    <artifactId>cc-custom-dns-resolver-java18</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>dek-registry</artifactId>
            <version>${io.confluent.schema-registry.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>schema-exporter</artifactId>
            <version>${io.confluent.schema-registry-plugins.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-server-common</artifactId>
            <classifier>test</classifier>
            <version>${ce.kafka.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.confluent.networking</groupId>
                    <artifactId>cc-custom-dns-resolver-java18</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
            <version>${ce.kafka.version}</version>
            <classifier>test</classifier>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.confluent.networking</groupId>
                    <artifactId>cc-custom-dns-resolver-java18</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.awaitility/awaitility -->
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>4.3.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-maven-plugin-jakarta</artifactId>
                <version>${swagger.version}</version>
                <executions>
                    <!-- Spec for schema-importer -->
                    <execution>
                        <id>schema-importer-spec</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                        <configuration>
                            <contextId>schema-importer</contextId>
                            <!-- Scan your resource package -->
                            <resourcePackages>
                                <package>io.confluent.schema.importer.web.rest.resources</package>
                            </resourcePackages>
                            <readAllResources>false</readAllResources>
                            <!-- Output -->
                            <outputFileName>schema-importer-api-spec</outputFileName>
                            <outputPath>${project.basedir}/generated/swagger-ui</outputPath>
                            <outputFormat>YAML</outputFormat>
                            <prettyPrint>true</prettyPrint>
                            <sortOutput>true</sortOutput>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- There’s an open issue showing later executions reusing the first execution’s resources -->
            <!-- Creating a separate plugin section to generate events context spec overcomes this -->
            <plugin>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-maven-plugin-jakarta</artifactId>
                <version>${swagger.version}</version>
                <executions>
                    <!-- Spec for events-context -->
                    <execution>
                        <id>events-context-api-spec</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                        <configuration>
                            <contextId>events-context</contextId>
                            <!-- Scan your resource package -->
                            <resourcePackages>
                                <package>io.confluent.schema.manager.web.rest.resources</package>
                            </resourcePackages>
                            <readAllResources>false</readAllResources>
                            <!-- Output -->
                            <outputFileName>events-contexts-api-spec</outputFileName>
                            <outputPath>${project.basedir}/generated/swagger-ui</outputPath>
                            <outputFormat>YAML</outputFormat>
                            <prettyPrint>true</prettyPrint>
                            <sortOutput>true</sortOutput>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>generate-code-coverage-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
