<?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>
  <parent>
    <groupId>io.apicurio</groupId>
    <artifactId>apicurio-registry</artifactId>
    <version>3.1.2</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>apicurio-registry-app</artifactId>
  <packaging>jar</packaging>
  <name>apicurio-registry-app</name>

  <properties>
    <projectRoot>${project.basedir}/..</projectRoot>
    <groups/>
  </properties>

  <dependencies>
    <!-- Projects -->
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-common</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-utils-kafka</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-schema-util-provider</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-config-definitions</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-config-index</artifactId>
    </dependency>

    <dependency>
      <!-- TODO: Create a parent pom.xml for the extension, otherwise Maven can't resolve module build order properly. -->
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-config-index-deployment</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-common-rest-client-jdk</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-common-rest-client-vertx</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-utils-import-export</artifactId>
    </dependency>

    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-protobuf-schema-utilities</artifactId>
    </dependency>

    <!-- Quarkus Dependencies -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-undertow</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jackson</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-jackson</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-health</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-micrometer-registry-prometheus</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-vertx</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-oidc</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-elytron-security-properties-file</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-jwt</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-scheduler</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-context-propagation</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-client</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-client-jackson</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-logging-json</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-fault-tolerance</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-logging-json</artifactId>
    </dependency>

    <!-- Persistence -->
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-agroal</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-postgresql</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-mysql</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-h2</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-mssql</artifactId>
    </dependency>

    <!-- Third Party Libraries -->
    <dependency>
      <groupId>io.roastedroot</groupId>
      <artifactId>quickjs4j</artifactId>
    </dependency>
    <dependency>
      <groupId>io.roastedroot</groupId>
      <artifactId>quickjs4j-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>io.roastedroot</groupId>
      <artifactId>quickjs4j-processor</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkiverse.quickjs4j</groupId>
      <artifactId>quarkus-quickjs4j</artifactId>
    </dependency>
    <dependency>
      <groupId>io.strimzi</groupId>
      <artifactId>kafka-oauth-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.semver4j</groupId>
      <artifactId>semver4j</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.yaml</groupId>
          <artifactId>snakeyaml</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>${snakeyaml.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>${commons-beanutils.version}</version>
    </dependency>

    <!-- Test Only -->
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-avro-serializer</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-protobuf-serializer</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-json-schema-serializer</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-connect-avro-converter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-test-common</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-avro-serde-kafka</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-java-sdk</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-v2-java-sdk</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-protobuf-serde-kafka</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-jsonschema-serde-kafka</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-avro-serde-pulsar</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-maven-plugin</artifactId>
      <type>maven-plugin</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-utils-tests</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.apicurio</groupId>
      <artifactId>apicurio-registry-utils-kafka</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.strimzi</groupId>
      <artifactId>strimzi-test-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.dasniko</groupId>
      <artifactId>testcontainers-keycloak</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.zonky.test</groupId>
      <artifactId>embedded-postgres</artifactId>
      <version>${embedded-postgres.version}</version>
      <!--$NO-MVN-MAN-VER$-->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>mssqlserver</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>mysql</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>raml-test-micro-service</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <filtering>false</filtering>
        <directory>src/main/resources-unfiltered</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
      </testResource>
      <testResource>
        <filtering>false</filtering>
        <directory>src/test/resources-unfiltered</directory>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
            <path>
              <groupId>io.quarkiverse.quickjs4j</groupId>
              <artifactId>quarkus-quickjs4j</artifactId>
              <version>${quarkus-quickjs4j.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipExec>${skipTests}</skipExec>
          <skipTests>${skipAppTests}</skipTests>
          <groups>${groups}</groups>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
            <org.jboss.logging.provider>jboss</org.jboss.logging.provider>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-openapi</id>
            <goals>
              <goal>unpack</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>apicurio-registry-common</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <includes>**/openapi.json</includes>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>merge-test-properties</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>process-test-classes</phase>
            <configuration>
              <output>${project.build.testOutputDirectory}/application.properties</output>
              <inputs>
                <param>${project.build.outputDirectory}/application.properties</param>
                <param>${project.build.outputDirectory}/application-prod.properties</param>
                <param>${project.build.outputDirectory}/application-test.properties</param>
              </inputs>
              <deleteInputs>false</deleteInputs>
            </configuration>
          </execution>
          <execution>
            <id>merge-properties</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <output>${project.build.outputDirectory}/application.properties</output>
              <inputs>
                <param>${project.build.outputDirectory}/application.properties</param>
                <param>${project.build.outputDirectory}/application-prod.properties</param>
                <param>${project.build.outputDirectory}/application-test.properties</param>
              </inputs>
              <deleteInputs>true</deleteInputs>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assembly</id>
            <goals>
              <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <finalName>${project.artifactId}-${project.version}</finalName>
              <attach>true</attach>
              <descriptors>
                <descriptor>src/main/assembly/assembly.xml</descriptor>
              </descriptors>
              <archiverConfig>
                <defaultDirectoryMode>0755</defaultDirectoryMode>
              </archiverConfig>
              <tarLongFileMode>${tar.long.file.mode}</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.7.1</version>
        <executions>
          <execution>
            <goals>
              <goal>detect</goal>
            </goals>
            <phase>initialize</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-codegen-maven-plugin</artifactId>
        <version>${version.apicurio-codegen-plugin}</version>
        <executions>
          <execution>
            <id>generate-api-ccompat-v3</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <projectSettings>
                <javaPackage>io.apicurio.registry.ccompat.rest.v7</javaPackage>
                <generatesOpenApi>false</generatesOpenApi>
              </projectSettings>
              <inputSpec>${project.basedir}/src/main/resources-unfiltered/META-INF/resources/api-specifications/ccompat/v7/openapi.json</inputSpec>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${version.build.helper.maven.plugin}</version>
        <executions>
          <execution>
            <id>addSource</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <sources>
                <source>${project.basedir}/target/generated-sources/jaxrs</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>${proto-plugin.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>gencode</id>
            <goals>
              <goal>compile</goal>
              <goal>test-compile</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <protoSourceRoot>./src/test/resources/schema</protoSourceRoot>
              <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <version>${avro.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>schema</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <stringType>String</stringType>
              <imports>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/AvroSchemaE.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/AvroSchemaA.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/AvroSchemaD.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/AvroSchemaC.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/AvroSchemaB.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/serde/LeadFallErstellen.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/ccompat/rest/subrecord.avsc</import>
                <import>${project.basedir}/src/test/resources/io/apicurio/registry/ccompat/rest/record.avsc</import>
              </imports>
              <sourceDirectory>${project.basedir}/src/test/resources/io/apicurio/registry/serde/</sourceDirectory>
              <outputDirectory>${project.basedir}/target/generated-test-sources</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dist</id>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.basedir}/target/generated-test-sources/protobuf/</directory>
                  <filtering>false</filtering>
                  <excludes/>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <properties>
        <quarkus.native.enabled>true</quarkus.native.enabled>
        <quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    <maven.home>${maven.home}</maven.home>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
