<?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>org.sourcelab</groupId>
    <artifactId>kafka-connect-client</artifactId>
    <version>3.1.1</version>
    <packaging>jar</packaging>

    <!-- Require Maven 3.3.9 -->
    <prerequisites>
        <maven>3.3.9</maven>
    </prerequisites>

    <!-- Module Description and Ownership -->
    <name>Kafka Connect Rest API Client</name>
    <description>A client for Kafka Connect's rest API</description>
    <url>https://github.com/sourcelaborg/kafka-connect-client</url>
    <developers>
        <developer>
            <name>Stephen Powis</name>
            <email>stephen.powis@gmail.com</email>
            <organization>SourceLab.org</organization>
            <organizationUrl>https://www.sourcelab.org/</organizationUrl>
        </developer>
    </developers>

    <!-- MIT License -->
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <!-- Source Control -->
    <scm>
        <connection>scm:git:git://github.com/sourcelaborg/kafka-connect-client.git</connection>
        <developerConnection>scm:git:ssh://github.com:sourcelaborg/kafka-connect-client.git</developerConnection>
        <url>https://github.com/SourceLabOrg/kafka-connect-client/tree/master</url>
    </scm>

    <!-- Module Properties -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- guava version -->
        <guava.version>30.1.1-jre</guava.version>

        <!-- Http Components version -->
        <http-components.version>4.5.13</http-components.version>

        <!-- Jackson version -->
        <jackson.version>2.12.2</jackson.version>

        <!-- Define which version of junit you'll be running -->
        <junit.version>4.13.1</junit.version>

        <!-- Specify which Checkstyle ruleset to use -->
        <checkstyle.ruleset>build/checkstyle-v1.5.xml</checkstyle.ruleset>
        <checkstyle.plugin.version>3.1.1</checkstyle.plugin.version>
        <checkstyle.version>8.32</checkstyle.version>

        <!-- Log4J Version -->
        <log4j2.version>2.13.2</log4j2.version>
        <slf4j.version>1.7.30</slf4j.version>

        <!-- test toggling -->
        <skipTests>false</skipTests>
        <skipCodeCoverage>true</skipCodeCoverage>
        <skipCheckStyle>false</skipCheckStyle>

        <!-- By default exclude Integration/End-to-End tests -->
        <excludeTests>categories.IntegrationTest</excludeTests>
    </properties>

    <!-- Project Dependencies -->
    <dependencies>
        <!-- Http Client -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${http-components.version}</version>
        </dependency>

        <!-- Guava for Preconditions and URI Escaping -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>

        <!-- For parsing XML responses to POJOs -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Logging Interface -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- Testing Tools -->
        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Mocking in Tests -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.28.2</version>
            <scope>test</scope>
        </dependency>

        <!-- Data providers on tests -->
        <dependency>
            <groupId>com.tngtech.java</groupId>
            <artifactId>junit-dataprovider</artifactId>
            <version>1.13.1</version>
            <scope>test</scope>
        </dependency>

        <!-- Used in tests for reading files -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.8.0</version>
            <scope>test</scope>
        </dependency>

        <!-- Test Http/Https Client -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>9.4.39.v20210325</version>
            <scope>test</scope>
        </dependency>

        <!-- Logging in tests -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Set Source & Target JRE Version -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <!-- Generates test results -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.19</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>-Xmx256M</argLine>
                    <skipTests>${skipTests}</skipTests>
                    <runOrder>alphabetical</runOrder>

                    <!-- By default exclude Integration Tests -->
                    <excludedGroups>
                        ${excludeTests}
                    </excludedGroups>
                </configuration>
            </plugin>

            <!-- Enforce check styles validation -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.plugin.version}</version>
                <executions>
                    <execution>
                        <id>checkstyle-validate</id>
                        <phase>validate</phase><!-- when we need to run checkstyle::check -->
                        <configuration>
                            <configLocation>${checkstyle.ruleset}</configLocation>
                            <encoding>utf-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <violationSeverity>warning</violationSeverity>
                            <failsOnError>true</failsOnError>
                            <enableRSS>false</enableRSS>

                            <!-- By default we run checkstyle validation-->
                            <skip>${skipCheckStyle}</skip>
                        </configuration>
                        <goals>
                            <!-- Generate site/html report -->
                            <goal>checkstyle</goal>

                            <!-- Enforce failing build on checkstyle failure -->
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- License Auditing -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <header>build/LICENSE.txt</header>
                    <excludes>
                        <exclude>**/.md</exclude>
                        <exclude>**/.bak</exclude>
                        <exclude>**.yml</exclude>
                        <exclude>**.yaml</exclude>
                        <exclude>**.xml</exclude>
                        <exclude>build/**</exclude>
                        <exclude>src/test/resources/**</exclude>
                        <exclude>src/main/resources/**</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Release plugin -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.7</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!-- Use a current version of checkstyle -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${checkstyle.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <!-- Generate Checkstyle html results during reporting phase -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.plugin.version}</version>
                <configuration>
                    <configLocation>${checkstyle.ruleset}</configLocation>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <!-- For deploying to maven central -->
    <distributionManagement>
        <!-- Snapshot repository -->
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <!-- release profile for deploying -->
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Build Sources Jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Build Javadoc Jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <source>8</source>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- GPG Signing of Artifacts -->
                    <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>
                                <configuration>
                                    <keyname>SourceLab.org</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>