<?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>

    <parent>
        <groupId>io.confluent</groupId>
        <artifactId>common</artifactId>
        <version>6.0.0</version>
    </parent>

    <groupId>io.confluent</groupId>
    <artifactId>kafka-connect-jdbc</artifactId>
    <packaging>jar</packaging>
    <version>10.6.4</version>
    <name>kafka-connect-jdbc</name>
    <organization>
        <name>Confluent, Inc.</name>
        <url>http://confluent.io</url>
    </organization>
    <url>http://confluent.io</url>
    <description>
       A Kafka Connect JDBC connector for copying data between databases and Kafka.
    </description>

    <licenses>
        <license>
            <name>Confluent Community License</name>
            <url>https://www.confluent.io/confluent-community-license</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/confluentinc/kafka-connect-jdbc.git</connection>
        <developerConnection>scm:git:git@github.com:confluentinc/kafka-connect-jdbc.git</developerConnection>
        <url>https://github.com/confluentinc/kafka-connect-jdbc</url>
        <tag>v10.6.4</tag>
    </scm>

    <properties>
        <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>
        <sqlite-jdbc.version>3.25.2</sqlite-jdbc.version>
        <oracle.jdbc.driver.version>19.7.0.0</oracle.jdbc.driver.version>
        <mssqlserver.jdbc.driver.version>8.4.1.jre8</mssqlserver.jdbc.driver.version>
        <postgresql.version>42.4.3</postgresql.version>
        <jtds.driver.version>1.3.1</jtds.driver.version>
        <slf4j.version>1.7.36</slf4j.version>
        <reload4j.version>1.2.19</reload4j.version>
        <licenses.name>Confluent Community 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>2.5.3</maven.release.plugin.version>
        <testcontainers.version>1.17.3</testcontainers.version>
    </properties>

    <repositories>
        <repository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>https://packages.confluent.io/maven/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>https://packages.confluent.io/maven/</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-runtime</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
         <!-- JDBC drivers, only included in runtime so they get packaged -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>${sqlite-jdbc.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <!--
            Include all of the production JARs without observability fixes.
            See https://www.oracle.com/database/technologies/maven-central-guide.html
            -->
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8-production</artifactId>
            <version>${oracle.jdbc.driver.version}</version>
            <type>pom</type>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>${mssqlserver.jdbc.driver.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>${jtds.driver.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-easymock</artifactId>
            <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-all</artifactId>
            <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>

        <!-- 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>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                        <arg>-Werror</arg>
                    </compilerArgs>
                </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>Kafka Connect JDBC</title>
                            <documentationUrl>https://docs.confluent.io/kafka-connect-jdbc/current/</documentationUrl>
                            <description>
                                The JDBC source and sink connectors allow you to exchange data between relational databases and Kafka.

                                The JDBC source connector allows you to import data from any relational database with a JDBC driver into Kafka topics. By using JDBC, this connector can support a wide variety of databases without requiring custom code for each one.

                                Data is loaded by periodically executing a SQL query and creating an output record for each row in the result set. By default, all tables in a database are copied, each to its own output topic. The database is monitored for new or deleted tables and adapts automatically. When copying data from a table, the connector can load only new or modified rows by specifying which columns should be used to detect new or modified data.

                                The JDBC sink connector allows you to export data from Kafka topics to any relational database with a JDBC driver. By using JDBC, this connector can support a wide variety of databases without requiring a dedicated connector for each one. 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/jdbc.jpg</logo>

                            <supportProviderName>Confluent, Inc.</supportProviderName>
                            <supportSummary>Confluent supports the JDBC sink and source connectors alongside community members as part of its Confluent Platform offering.</supportSummary>
                            <supportUrl>https://docs.confluent.io/current/</supportUrl>
                            <supportLogo>logos/confluent.png</supportLogo>

                            <ownerUsername>confluentinc</ownerUsername>
                            <ownerType>organization</ownerType>
                            <ownerName>Confluent, Inc.</ownerName>
                            <ownerUrl>https://confluent.io/</ownerUrl>
                            <ownerLogo>logos/confluent.png</ownerLogo>

                            <dockerNamespace>confluentinc</dockerNamespace>
                            <dockerName>cp-kafka-connect</dockerName>
                            <dockerTag>${project.version}</dockerTag>

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

                            <tags>
                                <tag>jdbc</tag>
                                <tag>database</tag>
                                <tag>dbms</tag>
                                <tag>rdbms</tag>
                                <tag>sql</tag>
                                <tag>mysql</tag>
                                <tag>postgresql</tag>
                                <tag>oracle</tag>
                                <tag>sql server</tag>
                                <tag>db2</tag>
                                <tag>sybase</tag>
                                <tag>vertica</tag>
                                <tag>sap hana</tag>
                                <tag>derby</tag>
                                <tag>sqlite</tag>
                            </tags>

                            <confluentControlCenterIntegration>true</confluentControlCenterIntegration>
                        </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>
                <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>${maven.release.plugin.version}</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>

    <profiles>
        <profile>
            <id>rpm</id>
            <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>rpm-maven-plugin</artifactId>
                    <version>2.1.5</version>
                    <executions>
                        <execution>
                            <id>generate-rpm</id>
                            <goals>
                                <goal>rpm</goal>
                            </goals>
                        </execution>
                    </executions>
                        <configuration>
                            <group>Applications/Internet</group>
                            <packager>Confluent Packaging</packager>
                            <license>${licenses.name}</license>
                            <needarch>noarch</needarch>
                            <targetOS>linux</targetOS>
                            <requires>
                                <require>confluent-common = ${confluent.version}</require>
                            </requires>
                            <mappings>
                                <mapping>
                                    <directory>/usr/share/java/${project.artifactId}</directory>
                                    <sources>
                                        <source>
                                            <location>${project.package.home}/share/java/${project.artifactId}</location>
                                        </source>
                                    </sources>
                                </mapping>
                                <mapping>
                                    <configuration>true</configuration>
                                    <directory>/etc/${project.artifactId}</directory>
                                    <sources>
                                        <source>
                                            <location>${project.package.home}/etc/${project.artifactId}</location>
                                        </source>
                                    </sources>
                                </mapping>
                                <mapping>
                                    <documentation>true</documentation>
                                    <directory>/usr/share/doc/${project.artifactId}</directory>
                                    <sources>
                                        <source>
                                            <location>${project.package.home}/share/doc/${project.artifactId}</location>
                                        </source>
                                    </sources>
                                </mapping>
                            </mappings>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>standalone</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/standalone.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>licenses-package</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>create-licenses</id>
                                <configuration>
                                    <mainClass>io.confluent.licenses.LicenseFinder</mainClass>
                                    <arguments>
                                        <!-- Note use of development instead of package so we pick up all dependencies. -->
                                        <argument>-i ${project.build.directory}/${project.build.finalName}-package/share/java/kafka-connect-jdbc</argument>
                                        <argument>-o ${project.basedir}/licenses</argument>
                                        <argument>-f</argument>
                                        <argument>-h ${project.build.directory}/${project.build.finalName}-package/share/doc/kafka-connect-jdbc/licenses.html</argument>
                                        <argument>-l ${project.build.directory}/${project.build.finalName}-package/share/doc/kafka-connect-jdbc/licenses</argument>
                                        <argument>-n ${project.build.directory}/${project.build.finalName}-package/share/doc/kafka-connect-jdbc/notices</argument>
                                        <argument>-t ${project.name}</argument>
                                        <argument>-x licenses-${confluent.version}.jar</argument>
                                    </arguments>
                                </configuration>
                                <phase>package</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includeProjectDependencies>true</includeProjectDependencies>
                            <includePluginDependencies>true</includePluginDependencies>
                            <executableDependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                            </executableDependency>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                                <version>${confluent.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
	<profile>
        <id>licenses-source</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>create-licenses</id>
                                <configuration>
                                    <mainClass>io.confluent.licenses.LicenseFinder</mainClass>
                                    <arguments>
                                        <!-- Note use of development instead of package so we pick up all dependencies. -->
                                        <argument>-i ${project.build.directory}/${project.build.finalName}-development/share/java/kafka-connect-jdbc</argument>
                                        <argument>-o ${project.basedir}/licenses</argument>
                                        <argument>-f</argument>
                                        <argument>-h ${project.basedir}/licenses.html</argument>
                                        <argument>-l ${project.basedir}/licenses</argument>
                                        <argument>-n ${project.basedir}/notices</argument>
                                        <argument>-t ${project.name}</argument>
                                        <argument>-x licenses-${confluent.version}.jar</argument>
                                    </arguments>
                                </configuration>
                                <phase>package</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includeProjectDependencies>true</includeProjectDependencies>
                            <includePluginDependencies>true</includePluginDependencies>
                            <executableDependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                            </executableDependency>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                                <version>${confluent.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>3.0.0</version>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>.</directory>
                                    <includes>
                                        <include>licenses.html</include>
                                        <directory>licenses/*.*</directory>
                                        <directory>notices/*.*</directory>
                                    </includes>
                                    <excludes>
                                        <!-- We have to manually keep this files until the license finder properly finds the Oracle license -->
                                        <exclude>licenses/LICENSE-ojdbc*.txt</exclude>
                                        <!-- We have to manually keep this files because the license information in the JAR
                                        uses an invalid URL to the MIT license -->
                                        <exclude>licenses/LICENSE-mssql-jdbc-*.txt</exclude>
                                    </excludes>
                                </fileset>
                            </filesets>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
