<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>
  <modules>
    <module>pulsar-flink-connector</module>
    <module>pulsar-flink-connector-shade-2.11</module>
    <module>pulsar-flink-connector-shade-2.12</module>
    <module>pulsar-flink-sql-connector-2.11</module>
    <module>pulsar-flink-sql-connector-2.12</module>
  </modules>

  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>23</version>
  </parent>

  <groupId>io.streamnative.connectors</groupId>
  <artifactId>pulsar-flink-parent</artifactId>
  <version>1.13.6.1-rc9</version>

  <name>StreamNative :: Pulsar Flink Connector :: Root</name>
  <url>https://pulsar.apache.org</url>
  <inceptionYear>2019</inceptionYear>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <connection>scm:git:https://github.com/streamnative/pulsar-flink.git</connection>
    <developerConnection>scm:git:https://github.com/streamnative/pulsar-flink.git
    </developerConnection>
    <url>https://github.com/streamnative/pulsar-flink</url>
    <tag>HEAD</tag>
  </scm>
  <issueManagement>
    <system>Github</system>
    <url>https://github.com/streamnative/pulsar-flink/issues</url>
  </issueManagement>
  <developers>
    <developer>
      <organization>StreamNative developers</organization>
      <organizationUrl>https://github.com/streamnative/pulsar-flink</organizationUrl>
    </developer>
  </developers>
  <properties>
    <!-- project configuration properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.scm.id>snbot-github</project.scm.id>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <redirectTestOutputToFile>true</redirectTestOutputToFile>
    <testRetryCount>3</testRetryCount>

    <!-- use Pulsar stable version -->
    <pulsar.version>2.8.3</pulsar.version>
    <flink.version>1.13.6</flink.version>
    <scala.binary.version>2.11</scala.binary.version>
    <lombok.version>1.18.18</lombok.version>
    <aircompressor.version>0.16</aircompressor.version>
    <netty.version>4.1.48.Final</netty.version>
    <janino.version>3.0.11</janino.version><!-- this should be the same version in flink-table module -->
    <protoc.version>3.11.1</protoc.version>
    <slf4j.version>1.7.25</slf4j.version>
    <flink-protobuf.version>2.7.6</flink-protobuf.version>

    <checkstyle.version>8.41</checkstyle.version>
    <testcontainers.version>1.16.3</testcontainers.version>
    <powermock.version>2.0.2</powermock.version>
    <mockito.version>3.7.7</mockito.version>
    <hamcrest.version>1.3</hamcrest.version>
    <junit.version>4.13.2</junit.version>
    <jna.version>5.7.0</jna.version>

    <!-- plugin dependencies -->
    <maven.version>3.5.4</maven.version>
    <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
    <license-maven-plugin.version>4.0.rc2</license-maven-plugin.version>
    <spotbugs-maven-plugin.version>4.2.2</spotbugs-maven-plugin.version>
    <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    <pulsar.systemtest.image>apachepulsar/pulsar:${pulsar.version}</pulsar.systemtest.image>
  </properties>

  <!-- dependencies for all modules -->
  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>${jna.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
          <compilerArgs>
            <!-- https://issues.apache.org/jira/browse/MCOMPILER-205 -->
            <compilerArg>-Xpkginfo:always</compilerArg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>license</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <header>tools/maven/license.template</header>

          <excludes>
            <exclude>LICENSE</exclude>
            <exclude>NOTICE</exclude>
            <exclude>.editorconfig</exclude>
            <exclude>src/resources/license.template</exclude>
            <exclude>**/build/**</exclude>
            <exclude>**/ahc.properties</exclude>
            <exclude>.github/**</exclude>
            <exclude>doc</exclude>
            <exclude>tools/**</exclude>
            <exclude>**/**.key</exclude>
          </excludes>
          <mapping>
            <proto>JAVADOC_STYLE</proto>
            <go>DOUBLESLASH_STYLE</go>
            <conf>SCRIPT_STYLE</conf>
            <ini>SCRIPT_STYLE</ini>
            <yaml>SCRIPT_STYLE</yaml>
            <tf>SCRIPT_STYLE</tf>
            <cfg>SCRIPT_STYLE</cfg>
            <Makefile>SCRIPT_STYLE</Makefile>
            <service>SCRIPT_STYLE</service>
            <cc>JAVADOC_STYLE</cc>
            <md>XML_STYLE</md>
            <txt>SCRIPT_STYLE</txt>
            <scss>JAVADOC_STYLE</scss>
            <Doxyfile>SCRIPT_STYLE</Doxyfile>
            <tfvars>SCRIPT_STYLE</tfvars>
          </mapping>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <executions>
          <execution>
            <id>checkstyle</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <!-- Note: match version with docs/flinkDev/ide_setup.md -->
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <sourceDirectories>
            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
            <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
          </sourceDirectories>
          <suppressionsLocation>/tools/maven/suppressions.xml</suppressionsLocation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <configLocation>/tools/maven/checkstyle.xml</configLocation>
          <logViolationsToConsole>true</logViolationsToConsole>
          <failOnViolation>true</failOnViolation>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>spotbugs</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <xmlOutput>true</xmlOutput>
          <threshold>Low</threshold>
          <effort>default</effort>
          <excludeFilterFile>tools/maven/spotbugs-exclude.xml</excludeFilterFile>
          <failOnError>true</failOnError>
        </configuration>
      </plugin>

      <!--surefire for unit tests and integration tests-->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <log4j.configuration>file:${project.build.testOutputDirectory}/log4j-tests.properties</log4j.configuration>
            <pulsar.systemtest.image>${pulsar.systemtest.image}</pulsar.systemtest.image>
          </systemPropertyVariables>
          <rerunFailingTestsCount>${testRetryCount}</rerunFailingTestsCount>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>central</id>
      <layout>default</layout>
      <url>https://repo1.maven.org/maven2</url>
    </repository>
    <repository>
      <id>bintray-streamnative-maven</id>
      <name>bintray</name>
      <url>https://dl.bintray.com/streamnative/maven</url>
    </repository>
  </repositories>

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

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <additionalJOption>-Xdoclint:none</additionalJOption>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <!-- Prevent `gpg` from using pinentry programs -->
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus-staging-maven-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
