<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2018 Confluent Inc.
  ~
  ~ Licensed under the Confluent Community License (the "License"); you may not use
  ~ this file except in compliance with the License.  You may obtain a copy of the
  ~ License at
  ~
  ~ http://www.confluent.io/confluent-community-license
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OF ANY KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations under the License.
  -->
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.tidbcloud</groupId>
    <artifactId>lake-kafka-connect</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>lake-kafka-connect</name>
    <organization>
        <name>Lake, Inc.</name>
        <url>https://lake.rs</url>
    </organization>
    <url>https://lake.rs</url>
    <description>
        A Kafka Connect Lake connector for copying data from Kafka to Lake.
    </description>

    <licenses>
        <license>
            <name>Apache License</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <derby.version>10.14.2.0</derby.version>
        <commons-io.version>2.4</commons-io.version>
        <kafka.connect.maven.plugin.version>0.11.1</kafka.connect.maven.plugin.version>
        <postgresql.version>42.4.3</postgresql.version>
        <junit.version>4.13</junit.version>
        <easymock.version>5.4.0</easymock.version>
        <zkclient.version>0.11</zkclient.version>
        <reload4j.version>1.2.19</reload4j.version>
        <mockito.version>5.14.2</mockito.version>
        <kafka.scala.version>2.13</kafka.scala.version>
        <ce.kafka.version>3.5.0</ce.kafka.version>
        <kafka.version>3.5.0</kafka.version>
        <zookeeper.version>3.5.8</zookeeper.version>
        <slf4j.version>2.0.0</slf4j.version>
        <licenses.name>Apache License</licenses.name>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.package.home>target/${project.artifactId}-${project.version}-package</project.package.home>
        <maven.release.plugin.version>3.9.1</maven.release.plugin.version>
        <testcontainers.version>1.17.3</testcontainers.version>
        <lake.jdbc.driver.version>0.4.6</lake.jdbc.driver.version>
    </properties>
    <repositories>
        <repository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>https://packages.confluent.io/maven/</url>
        </repository>

        <repository>
            <id>cloudera-repo</id>
            <url>
                https://repository.cloudera.com/content/repositories/releases/
            </url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

<!--    <repositories>-->
<!--        <repository>-->
<!--            <id>lake</id>-->
<!--            <name>Lake</name>-->
<!--            <url>maven</url>-->
<!--        </repository>-->
<!--    </repositories>-->
<!--    <pluginRepositories>-->
<!--        <pluginRepository>-->
<!--            <id>lake</id>-->
<!--            <name>Lake</name>-->
<!--            <url>maven</url>-->
<!--        </pluginRepository>-->
<!--    </pluginRepositories>-->

    <dependencies>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-api</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-runtime</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
            <scope>runtime</scope>
        </dependency>
        <!-- Add all packages imported by ojdbc8-production explicitly to pom when bumping up driver version -->
        <!-- Do not use ojdbc8-production directly to avoid .pom file in final package -->
        <!-- See https://www.oracle.com/database/technologies/maven-central-guide.html -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>${easymock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-reload4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.reload4j</groupId>
            <artifactId>reload4j</artifactId>
            <version>${reload4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.zonky.test</groupId>
            <artifactId>embedded-postgres</artifactId>
            <version>1.2.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.vorburger.mariaDB4j</groupId>
            <artifactId>mariaDB4j</artifactId>
            <version>2.4.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-runtime</artifactId>
            <version>${kafka.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-runtime</artifactId>
            <version>${kafka.version}</version>
            <type>test-jar</type>
            <classifier>test</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_${kafka.scala.version}</artifactId>
            <version>${kafka.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_${kafka.scala.version}</artifactId>
            <version>${kafka.version}</version>
            <type>test-jar</type>
            <classifier>test</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
            <version>${kafka.version}</version>
            <classifier>test</classifier>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>oracle-xe</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- The suite is JUnit 4. Jupiter on the classpath makes surefire pick the
                 JUnit Platform provider, which needs the vintage engine to see them. -->
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- common pom defines them in dependency management and hence they're pulled in compile scope.
        Explicitly define them as test to prevent from them form being packaged. -->
        <dependency>
            <groupId>com.101tec</groupId>
            <artifactId>zkclient</artifactId>
            <version>${zkclient.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>${zookeeper.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.tidbcloud</groupId>
            <artifactId>lake-jdbc</artifactId>
            <version>${lake.jdbc.driver.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.11.3</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-compress</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-avro-serializer</artifactId>
            <version>7.2.1</version>
            <exclusions>
                <exclusion>
                    <groupId>io.confluent</groupId>
                    <artifactId>common-utils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.confluent/kafka-connect-avro-converter -->
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-connect-avro-converter</artifactId>
            <version>7.2.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>32.0.1-jre</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>failureaccess</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-schema-registry-client</artifactId>
            <version>7.2.1</version>
            <exclusions>
                <exclusion>
                    <groupId>io.confluent</groupId>
                    <artifactId>common-utils</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.confluent</groupId>
                    <artifactId>common-config</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.11.3</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-compress</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.confluent</groupId>
                <version>${kafka.connect.maven.plugin.version}</version>
                <artifactId>kafka-connect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>kafka-connect</goal>
                        </goals>
                        <configuration>
                            <title>Lake Kafka Connect</title>
                            <documentationUrl>https://lake.rs</documentationUrl>
                            <description>
                                The Lake sink connectors allow you to consume data from kafka and write into Lake table.

                                The Lake sink connector allows you to export data from Kafka topics to Lake
                                database. The connector polls data from Kafka to write to the database based on the
                                topics subscription. It is possible to achieve idempotent writes with upserts.
                                Auto-creation of tables, and limited auto-evolution is also supported.
                            </description>
                            <logo>logos/lake.jpg</logo>


                            <supportProviderName>Lake, Inc.</supportProviderName>
                            <supportSummary>Lake Community</supportSummary>
                            <supportUrl>https://lake.rs</supportUrl>
                            <supportLogo>logos/lake.png</supportLogo>

                            <ownerUsername>lakeCloud</ownerUsername>
                            <ownerType>organization</ownerType>
                            <ownerName>Lake, Inc.</ownerName>
                            <ownerUrl>https://lake.rs/</ownerUrl>
                            <ownerLogo>logos/lake.png</ownerLogo>

<!--                            <dockerNamespace>lake</dockerNamespace>-->
<!--                            <dockerName>lake-kafka-connect</dockerName>-->
<!--                            <dockerTag>${project.version}</dockerTag>-->

                            <componentTypes>
                                <componentType>sink</componentType>
                            </componentTypes>

                            <tags>
                                <tag>lake-jdbc</tag>
                                <tag>database</tag>
                                <tag>dbms</tag>
                                <tag>rdbms</tag>
                                <tag>lake</tag>
                                <tag>mysql</tag>
                                <tag>postgresql</tag>
                            </tags>

                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <!--normal integration tests should not run the memory-restricted tests -->
                        <id>integration-test</id>
                        <configuration>
                            <excludes>
                                <exclude>**/*OOM*.java</exclude>
                            </excludes>
                            <trimStackTrace>false</trimStackTrace>
                        </configuration>
                    </execution>
                    <execution>
                        <id>integration-test-memory-restricted</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <configuration>
                            <!-- out-of-memory tests should have a restricted heap size-->
                            <argLine>@{argLine} -Djava.awt.headless=true -Xmx128M</argLine>
                            <includes>
                                <include>**/*OOM*.java</include>
                            </includes>
                            <trimStackTrace>false</trimStackTrace>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/assembly/development.xml</descriptor>
                        <descriptor>src/assembly/package.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-checkstyle-plugin</artifactId>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>validate</id>-->
<!--                        <phase>validate</phase>-->
<!--                        <configuration>-->
<!--                            <suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation>-->
<!--                        </configuration>-->
<!--                        <goals>-->
<!--                            <goal>check</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-release-plugin</artifactId>-->
<!--                <version>3.0.1</version>-->
<!--                <configuration>-->
<!--                    <autoVersionSubmodules>true</autoVersionSubmodules>-->
<!--                    <remoteTagging>false</remoteTagging>-->
<!--                    <tagNameFormat>v@{project.version}</tagNameFormat>-->
<!--                </configuration>-->
<!--            </plugin>-->
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

</project>
