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

    <groupId>com.github.fbascheper</groupId>
    <artifactId>kafka-connect-telegram</artifactId>
    <packaging>jar</packaging>
    <version>0.2.0</version>
    <name>kafka-connect-telegram</name>
    <url>https://github.com/fbascheper/kafka-connect-telegram</url>
    <description>
        A Kafka Connect Telegram sink connector to send messages from Kafka.
    </description>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/fbascheper/kafka-connect-telegram.git</connection>
        <url>https://github.com/fbascheper/kafka-connect-telegram</url>
        <developerConnection>scm:git:https://github.com/fbascheper/kafka-connect-telegram.git
        </developerConnection>
        <tag>kafka-connect-telegram-0.2.0</tag>
    </scm>

    <developers>
        <developer>
            <id>fbascheper</id>
            <name>Erik-Berndt Scheper</name>
        </developer>
    </developers>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>

    <properties>
        <kafka-connect-telegram-avro-model.version>0.1.1</kafka-connect-telegram-avro-model.version>

        <java.version>1.8</java.version>
        <scala.version>2.11.8</scala.version>
        <confluent.version>5.0.0</confluent.version>
        <kafka.version>2.0.0</kafka.version>
        <avro.version>1.8.2</avro.version>
        <commons-compress.version>1.18</commons-compress.version>
        <slf4j.version>1.7.25</slf4j.version>

        <telegrambots.version>4.1</telegrambots.version>
        <glassfish.version>2.25.1</glassfish.version>
        <jerseybundle.version>1.19.3</jerseybundle.version>

        <scalamock.version>3.6.0</scalamock.version>
        <mockito.version>1.10.19</mockito.version>
        <scalatest.version>3.0.1</scalatest.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <confluent.maven.repo>http://packages.confluent.io/maven/</confluent.maven.repo>
        <confluent.kafka-connect-maven-plugin.version>0.11.1</confluent.kafka-connect-maven-plugin.version>

        <!-- START update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->
        <guava.version>25.1-android</guava.version>
        <guice.version>4.2.2</guice.version>
        <jackson.version>2.9.7</jackson.version>
        <jacksonanotation.version>2.9.0</jacksonanotation.version>
        <json.version>20180813</json.version>
        <!-- END update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->

    </properties>

    <repositories>
        <repository>
            <id>confluent</id>
            <name>Confluent</name>
            <url>${confluent.maven.repo}</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- =============== COMPILE dependencies =============== -->
        <dependency>
            <groupId>com.github.fbascheper</groupId>
            <artifactId>kafka-connect-telegram-avro-model</artifactId>
            <version>${kafka-connect-telegram-avro-model.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>${avro.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-compress</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>${commons-compress.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.telegram</groupId>
            <artifactId>telegrambots</artifactId>
            <version>${telegrambots.version}</version>
            <!-- START update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.jaxrs</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.json</groupId>
                    <artifactId>json</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
            <!-- END update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->
        </dependency>

        <!-- START update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jacksonanotation.version}</version>
        </dependency>
        
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${json.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>${guice.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.j2objc</groupId>
                    <artifactId>j2objc-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>animal-sniffer-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>checker-compat-qual</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- END update dependencies for https://github.com/rubenlagus/TelegramBots/issues/547 -->


        <!-- =============== PROVIDED dependencies =============== -->
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-api</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.confluent</groupId>
            <artifactId>kafka-connect-avro-converter</artifactId>
            <version>${confluent.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>${glassfish.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-grizzly2-http</artifactId>
            <version>${glassfish.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-server</artifactId>
            <version>${glassfish.version}</version>
            <scope>provided</scope>
        </dependency>


        <!-- =============== TEST dependencies =============== -->
        <dependency>
            <groupId>org.scalamock</groupId>
            <artifactId>scalamock-scalatest-support_2.11</artifactId>
            <version>${scalamock.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_2.11</artifactId>
            <version>${scalatest.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <!-- make sure wrong scala version is not pulled in -->
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/test/resources</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>copy-resources</goal>
                            <goal>testResources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <recompileMode>incremental</recompileMode>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>add-source</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <inherited>true</inherited>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <compilerArgument>-Xlint:unchecked</compilerArgument>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>
    <profiles>
        <!-- Activate using the release property: mvn clean install -Prelease -->
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <!-- Set this to true and the release will automatically proceed and sync to Central Repository will follow  -->
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <plugin>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>2.5.3</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.scm</groupId>
                                <artifactId>maven-scm-provider-gitexe</artifactId>
                                <version>1.9.4</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <plugin>
                        <groupId>io.confluent</groupId>
                        <artifactId>kafka-connect-maven-plugin</artifactId>
                        <version>${confluent.kafka-connect-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>kafka-connect</goal>
                                </goals>
                                <configuration>
                                    <title>Kafka Connect Telegram</title>
                                    <documentationUrl>https://github.com/fbascheper/kafka-connect-telegram
                                    </documentationUrl>
                                    <description>
                                        The Telegram connector allows moving data from Kafka to a Telegram chat. It
                                        writes data from a topic in Kafka to the configured chat-id.
                                        It's possible to send both text, photo and video messages to chats. For complex
                                        models you must use an Avro model, preferably
                                        in combination with the kafka-connect-avro-converter.
                                    </description>

                                    <ownerUsername>fbascheper</ownerUsername>
                                    <ownerType>user</ownerType>
                                    <ownerName>Erik-Berndt Scheper.</ownerName>
                                    <ownerUrl>https://github.com/fbascheper</ownerUrl>

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

                                    <tags>
                                        <tag>Telegram</tag>
                                        <tag>chat</tag>
                                    </tags>

                                    <requirements>
                                        <requirement>Telegram Bot API</requirement>
                                    </requirements>

                                    <confluentControlCenterIntegration>true</confluentControlCenterIntegration>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>attach-artifacts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>attach-artifact</goal>
                                </goals>
                                <configuration>
                                    <artifacts>
                                        <artifact>
                                            <file>
                                                ${project.build.directory}/components/packages/fbascheper-${project.artifactId}-${project.version}.zip
                                            </file>
                                            <type>zip</type>
                                            <classifier>confluent-hub-component</classifier>
                                        </artifact>
                                    </artifacts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

</project>
