<?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>
        <groupId>io.debezium</groupId>
        <artifactId>debezium-parent</artifactId>
        <version>3.0.8.Final-redhat-00004</version>
        <relativePath>../debezium-parent/pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>debezium-connector-jdbc</artifactId>
    <version>3.0.8.Final-redhat-00004</version>
    <name>Debezium JDBC Sink Connector</name>
    <packaging>jar</packaging>

    <properties>
        <!-- Other artifact versions -->
        <version.hibernate>6.4.8.Final-redhat-00002</version.hibernate>
        <version.c3p0>0.9.5.5-redhat-00009</version.c3p0>
        <version.assertjdb>2.0.2</version.assertjdb>
        <!--
        By default only run the integration tests for MySQL, PostgreSQL, and SQL Server.
        Other tags include it-db2 and it-oracle for the DB2 and Oracle integration tests.

        Additionally, there are also end to end test tags that can be specified:
        e2e-mysql, e2e-postgresql, e2e-sqlserver, e2e-db2, and e2e-oracle

        Finally, there are 3 all-inclusive tags that can be specified:
            it - runs all integration tests
            e2e - runs all end to end tests
            all - runs all integration and end to end tests
        -->
        <test.tags>it-mysql,it-postgresql,it-sqlserver</test.tags>

        <connector.assembly.ref>connector-distribution</connector.assembly.ref>
    </properties>

    <dependencies>
        <!-- Debezium -->
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-sink</artifactId>
        </dependency>

        <!-- Kafka-->
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-runtime</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-reload4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${version.hibernate}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>${version.hibernate}</version>
        </dependency>

        <!-- Connection pool -->
        <dependency>
            <groupId>com.mchange</groupId>
            <artifactId>c3p0</artifactId>
            <version>${version.c3p0}</version>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easytesting</groupId>
            <artifactId>fest-assert</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-core</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-embedded</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.debezium</groupId>
            <artifactId>debezium-testing-testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mssqlserver</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>db2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>oracle-xe</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-db</artifactId>
            <version>${version.assertjdb}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Drivers -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ibm.db2</groupId>
            <artifactId>jcc</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc11</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Integration test -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <groups>${test.tags}</groups>
                    <systemPropertyVariables>
                        <source.time_zone>UTC</source.time_zone>
                        <sink.time_zone>Europe/Vienna</sink.time_zone>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <!-- Override maven-checkstyle-plugin configuration to ignore target/generated-sources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                    <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <linkXRef>false</linkXRef>
                    <violationSeverity>error</violationSeverity>
                    <sourceDirectories>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                    </sourceDirectories>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <!-- Apply the properties set in the POM to the resource files -->
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>*</include>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>*</include>
                    <include>**/*</include>
                </includes>
            </testResource>
        </testResources>
    </build>

    <profiles>
        <profile>
            <id>assembly</id>
            <activation>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>${version.assembly.plugin}</version>
                        <dependencies>
                            <dependency>
                                <groupId>io.debezium</groupId>
                                <artifactId>debezium-assembly-descriptors</artifactId>
                                <version>${project.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>default</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}</finalName>
                                    <attach>true</attach>  <!-- we want attach & deploy these to Maven -->
                                    <descriptorRefs>
                                        <descriptorRef>${connector.assembly.ref}</descriptorRef>
                                    </descriptorRefs>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Do not perform any Docker-related functionality
            To use, specify "-DskipITs" on the Maven command line.
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>skip-integration-tests</id>
            <activation>
                <property>
                    <name>skipITs</name>
                </property>
            </activation>
            <properties>
                <docker.skip>true</docker.skip>
            </properties>
        </profile>
        <profile>
            <id>quick</id>
            <activation>
                <property>
                    <name>quick</name>
                </property>
            </activation>
            <properties>
                <skipITs>true</skipITs>
                <docker.skip>true</docker.skip>
            </properties>
        </profile>
    </profiles>
</project>
