<?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.holunda.polyflow</groupId>
    <artifactId>polyflow-view-parent</artifactId>
    <version>4.2.2</version>
  </parent>

  <artifactId>polyflow-view-jpa</artifactId>
  <name>core/view/${project.artifactId}</name>

  <dependencies>
    <dependency>
      <groupId>io.holunda.polyflow</groupId>
      <artifactId>polyflow-view-api</artifactId>
    </dependency>
    <dependency>
      <groupId>io.holunda.polyflow</groupId>
      <artifactId>polyflow-variable-serializer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.axonframework</groupId>
      <artifactId>axon-messaging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.axonframework</groupId>
      <artifactId>axon-configuration</artifactId>
    </dependency>
    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.projectreactor.kotlin</groupId>
      <artifactId>reactor-kotlin-extensions</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>junit-jupiter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>mariadb</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.flywaydb</groupId>
      <artifactId>flyway-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.flywaydb</groupId>
      <artifactId>flyway-mysql</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-spring</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-spring-junit5</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-html5-report</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito.kotlin</groupId>
      <artifactId>mockito-kotlin</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.holixon.axon.gateway</groupId>
      <artifactId>axon-gateway-spring-boot-starter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.axonframework</groupId>
      <artifactId>axon-spring-boot-starter</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.axonframework</groupId>
          <artifactId>axon-server-connector</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>kotlin-maven-plugin</artifactId>
        <groupId>org.jetbrains.kotlin</groupId>
        <configuration>
          <pluginOptions>
            <option>all-open:annotation=jakarta.persistence.Entity</option>
            <option>all-open:annotation=jakarta.persistence.Embeddable</option>
            <option>all-open:annotation=jakarta.persistence.MappedSuperclass</option>
          </pluginOptions>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>generate-sql</id>
      <properties>
        <jacoco.skip>true</jacoco.skip>
      </properties>
      <build>
        <defaultGoal>clean process-classes</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.3.1</version>
            <executions>
              <execution>
                <id>copy persistence xml</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/sql</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>de.juplo</groupId>
            <artifactId>hibernate-maven-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
              <execution>
                <id>generate-h2-ddl</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>create</goal>
                </goals>
                <configuration>
                  <dialect>org.hibernate.dialect.H2Dialect</dialect>
                  <physicalNamingStrategy>
                    org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                  </physicalNamingStrategy>
                  <execute>false</execute>
                  <show>true</show>
                  <format>true</format>
                  <force>true</force>
                  <outputFile>h2_ddl.sql</outputFile>
                </configuration>
              </execution>
              <execution>
                <id>generate-mssql-ddl</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>create</goal>
                </goals>
                <configuration>
                  <dialect>org.hibernate.dialect.SQLServer2012Dialect</dialect>
                  <physicalNamingStrategy>
                    org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                  </physicalNamingStrategy>
                  <execute>false</execute>
                  <show>true</show>
                  <format>true</format>
                  <force>true</force>
                  <outputFile>mssql_ddl.sql</outputFile>
                </configuration>
              </execution>
              <execution>
                <id>generate-posgresql-ddl</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>create</goal>
                </goals>
                <configuration>
                  <dialect>org.hibernate.dialect.PostgreSQL10Dialect</dialect>
                  <physicalNamingStrategy>
                    org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
                  </physicalNamingStrategy>
                  <execute>false</execute>
                  <show>true</show>
                  <format>true</format>
                  <force>true</force>
                  <outputFile>pgsql_ddl.sql</outputFile>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.30.2-GA</version>
              </dependency>
              <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.4.0-b180830.0359</version>
              </dependency>
              <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>mssql-jdbc</artifactId>
                <version>12.8.1.jre11</version>
              </dependency>
              <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>42.7.4</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
