<!--

    Copyright 2017-2023 O2 Czech Republic, a.s.

    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>

  <groupId>cz.o2.proxima</groupId>
  <artifactId>platform-parent</artifactId>
  <version>0.10.0</version>
  <packaging>pom</packaging>
  <inceptionYear>2017</inceptionYear>

  <name>${project.groupId}:${project.artifactId}</name>

  <description>Proxima platform is batch and realtime storage and data processing abstraction</description>
  <url>https://github.com/O2-Czech-Republic/proxima-platform</url>

  <developers>
    <developer>
      <id>je-ik</id>
      <name>Jan Lukavsky</name>
      <email>je.ik@seznam.cz</email>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>Europe/Prague</timezone>
    </developer>
  </developers>

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

  <scm>
    <connection>scm:git:git@github.com:O2-Czech-Republic/proxima-platform.git</connection>
    <developerConnection>scm:git:git@github.com:O2-Czech-Republic/proxima-platform.git</developerConnection>
    <url>https://github.com/O2-Czech-Republic/proxima-platform.git</url>
    <tag>HEAD</tag>
  </scm>

  <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>
    <site>
      <url>scp://www.datadriven.cz/proxima</url>
      <id>datadriven</id>
    </site>
  </distributionManagement>

  <properties>
    <proxima.main.project.version>0.10.0</proxima.main.project.version>
    <maven.shade.version>3.4.1</maven.shade.version>
    <maven.surefire.version>3.0.0-M5</maven.surefire.version>
    <maven.source.version>3.2.1</maven.source.version>
    <maven.javadoc.version>3.2.0</maven.javadoc.version>
    <maven.jar.version>3.2.0</maven.jar.version>
    <maven.ext.os.version>1.6.2</maven.ext.os.version>
    <maven.protobuf.version>0.6.1</maven.protobuf.version>
    <maven.compiler.plugin>3.8.1</maven.compiler.plugin>
    <groovy.version>4.0.7</groovy.version>
    <hadoop.version>2.10.1</hadoop.version>
    <hbase.version>1.6.0</hbase.version>
    <junit.jupiter.version>5.7.2</junit.jupiter.version>
    <kafka.version>2.8.1</kafka.version>
    <proto.version>3.21.4</proto.version>
    <protoc.version>3.21.4</protoc.version>
    <grpc.version>1.48.0</grpc.version>
    <gmaven.version>1.10.0</gmaven.version>
    <guava.version>31.1-jre</guava.version>
    <commons-io.version>2.7</commons-io.version>
    <license-maven-plugin.version>4.1</license-maven-plugin.version>
    <log4j.version>2.19.0</log4j.version>
    <log4j-over-slf4j.version>1.7.33</log4j-over-slf4j.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <netty.version>4.1.42.Final</netty.version>
    <slf4j.version>1.7.30</slf4j.version>
    <argLine></argLine>
    <surefire.forkCount>16</surefire.forkCount>
    <surefire.cmdArgs>-DLOG_LEVEL=WARN</surefire.cmdArgs>
    <!-- sonar config -->
    <jacoco.version>0.8.6</jacoco.version>
    <sonar.organization>datadriven</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.login>21787938b088389dc6edfdf1cf4008e91b81e70b</sonar.login>
    <error-prone.version>2.4.0</error-prone.version>
    <coreShade>cz.o2.proxima.internal.shaded</coreShade>
    <autoservice.version>1.0</autoservice.version>
    <lombok.version>1.18.22</lombok.version>
    <spotless.version>2.0.1</spotless.version>
    <!-- apache beam related properties -->
    <apache.beam.groupId>org.apache.beam</apache.beam.groupId>
    <apache.beam.version>2.43.0</apache.beam.version>
    <apache.beam.groupId.raw>org.apache.beam</apache.beam.groupId.raw>
    <apache.beam.version.raw>${apache.beam.version}</apache.beam.version.raw>
    <zookeeper.version>3.6.2</zookeeper.version>
    <mockito.version>3.10.0</mockito.version>
    <elasticsearch.client.version>7.17.2</elasticsearch.client.version>
    <jackson.databind.version>2.12.6.1</jackson.databind.version>
  </properties>

  <profiles>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
              <execution>
                <id>enforce-no-snapshots</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseDeps>
                      <message>No Snapshots Allowed!</message>
                    </requireReleaseDeps>
                  </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.version}</version>
            <configuration>
              <includePom>true</includePom>
            </configuration>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</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>install</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>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>allow-snapshots</id>
      <repositories>
        <repository>
          <id>sonatype-snapshots-repo</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
          <id>apache-snapshots-repo</id>
          <url>https://repository.apache.org/content/repositories/snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>snapshots-repo</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <id>with-sources</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.version}</version>
            <configuration>
              <includePom>true</includePom>
            </configuration>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>with-coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.version}</version>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>ci</id>
      <properties>
        <surefire.forkCount>1</surefire.forkCount>
        <surefire.cmdArgs>-DLOG_LEVEL=ERROR</surefire.cmdArgs>
      </properties>
    </profile>

    <profile>
      <id>debug</id>
      <properties>
        <surefire.cmdArgs>-DLOG_LEVEL=DEBUG</surefire.cmdArgs>
      </properties>
    </profile>

    <profile>
      <!-- using github.com/google/error-prone-javac is required when running on JDK 8 -->
      <id>jdk8</id>
      <activation>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <javac.version>9+181-r4173-1</javac.version>
        <javac.source>1.8</javac.source>
        <javac.target>1.8</javac.target>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin}</version>
            <configuration>
              <fork>true</fork>
              <source>8</source>
              <target>8</target>
              <compilerArgs>
                <arg>-Xlint:all</arg>
              </compilerArgs>
              <annotationProcessorPaths>
                <path>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok</artifactId>
                  <version>${lombok.version}</version>
                </path>
                <path>
                  <groupId>com.google.auto.service</groupId>
                  <artifactId>auto-service</artifactId> 
                  <version>${autoservice.version}</version>
                </path>
              </annotationProcessorPaths>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <modules>
        <module>beam</module>
        <module>flink</module>
        <module>core</module>
        <module>direct</module>
        <module>example</module>
        <module>io</module>
        <module>maven</module>
        <module>scheme</module>
        <module>tools</module>
        <module>utils-zookeeper</module>
      </modules>
    </profile>

    <profile>
      <id>jdk11</id>
      <activation>
        <jdk>11</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin}</version>
            <configuration>
              <fork>true</fork>
              <source>11</source>
              <target>11</target>
              <compilerArgs>
                <arg>-XDcompilePolicy=simple</arg>
                <!-- workaround of https://github.com/google/error-prone/issues/1321 -->
                <arg>-Xplugin:ErrorProne -Xep:ParameterName:OFF -Xep:UnusedVariable:OFF</arg>
                <arg>-Xlint:all</arg>
              </compilerArgs>
              <annotationProcessorPaths>
                <path>
                  <groupId>com.google.errorprone</groupId>
                  <artifactId>error_prone_core</artifactId>
                  <version>${error-prone.version}</version>
                </path>
                <path>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok</artifactId>
                  <version>${lombok.version}</version>
                </path>
                <path>
                  <groupId>com.google.auto.service</groupId>
                  <artifactId>auto-service</artifactId> 
                  <version>${autoservice.version}</version>
                </path>
              </annotationProcessorPaths>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <modules>
        <module>beam</module>
        <module>flink</module>
        <module>core</module>
        <module>direct</module>
        <module>example</module>
        <module>io</module>
        <module>maven</module>
        <module>scheme</module>
        <module>tools</module>
        <module>utils-zookeeper</module>
      </modules>
    </profile>

    <profile>
      <id>release-snapshot</id>
      <pluginRepositories>
        <pluginRepository>
          <id>my-repo-bucket-snapshot</id>
          <url>gs://datadrivencz-maven-artifacts/snapshot</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

    <profile>
      <id>site</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>3.1.0</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.9.1</version>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.version}</version>
            <configuration>
              <source>8</source>
              <!-- otherwise it fail with junit5 -->
              <show>private</show>
              <!-- hotfix for https://github.com/O2-Czech-Republic/proxima-platform/issues/185 -->
              <doclint>none</doclint>
              <detectJavaApiLink>false</detectJavaApiLink>
            </configuration>
            <reportSets>
              <reportSet>
                <reports>
                  <report>javadoc</report>
                  <report>test-javadoc</report>
                  <report>aggregate-no-fork</report>
                  <report>test-aggregate-no-fork</report>
                </reports>
              </reportSet>
              <reportSet>
                <id>aggregate</id>
                <inherited>false</inherited>
                <!--inherited>true</inherited-->
                <reports>
                  <report>aggregate</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
    </profile>

  </profiles>

  <build>

    <extensions>
      <extension>
        <groupId>com.gkatzioura.maven.cloud</groupId>
        <artifactId>google-storage-wagon</artifactId>
        <version>1.7</version>
      </extension>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>${maven.ext.os.version}</version>
      </extension>
    </extensions>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.version}</version>
        <configuration>
          <forkCount>${surefire.forkCount}</forkCount>
          <reuseForks>false</reuseForks>
          <threadCount>1</threadCount>
          <parallel>methods</parallel>
          <perCoreThreadCount>false</perCoreThreadCount>
          <useSystemClassLoader>true</useSystemClassLoader>
          <useManifestOnlyJar>false</useManifestOnlyJar>
          <argLine>@{argLine} -Xmx1g -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Dsun.io.serialization.extendedDebugInfo=true ${surefire.cmdArgs}</argLine>
          <includes>
            <include>**/*Test.java</include>
            <include>**/*IT.java</include>
          </includes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.7.0</version>
          </dependency>
        </dependencies>
      </plugin>

      <!-- help managing license headers -->
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license-maven-plugin.version}</version>
        <configuration>
          <header>license-header.txt</header>
          <properties>
            <owner>O2 Czech Republic, a.s.</owner>
          </properties>
          <mapping>
            <txt>SCRIPT_STYLE</txt>
            <proto>SLASHSTAR_STYLE</proto>
            <avsc>JAVADOC_STYLE</avsc>
            <Makefile>SCRIPT_STYLE</Makefile>
            <yaml>SCRIPT_STYLE</yaml>
            <conf>SLASHSTAR_STYLE</conf>
            <cql>SLASHSTAR_STYLE</cql>
          </mapping>

          <excludes>
            <exclude>**/license-header.txt</exclude>
            <exclude>**/license-header-spotless.txt</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>**/README</exclude>
            <exclude>**/LICENSE</exclude>
            <exclude>**/src/test/resources/**</exclude>
            <exclude>**/src/main/resources/**</exclude>
            <exclude>install-jdk.sh</exclude>
            <exclude>**/*.odg</exclude>
            <exclude>docs/**</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin-git</artifactId>
            <version>${license-maven-plugin.version}</version>
          </dependency>
        </dependencies>
      </plugin>

      <!-- javadoc -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven.javadoc.version}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>8</source>
          <!-- otherwise it fail with junit5 -->
          <show>private</show>
          <!-- hotfix for https://github.com/O2-Czech-Republic/proxima-platform/issues/185 -->
          <doclint>none</doclint>
          <detectJavaApiLink>false</detectJavaApiLink>
        </configuration>
      </plugin>

      <!-- spotless -->
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.version}</version>
        <configuration>
          <java>
             <googleJavaFormat>
               <!-- Optional, available versions: https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.googlejavaformat%22%20AND%20a%3A%22google-java-format%22 -->
               <version>1.6</version>
               <!-- Optional, available versions: GOOGLE, AOSP  https://github.com/google/google-java-format/blob/master/core/src/main/java/com/google/googlejavaformat/java/JavaFormatterOptions.java -->
               <style>GOOGLE</style>
             </googleJavaFormat>
             <removeUnusedImports />
             <licenseHeader>
               <file>${basedir}/license-header-spotless.txt</file>
             </licenseHeader>
             <!--importOrder>
               Specify either order or file, but not both
               <order>java,javax,org,com,com.diffplug,</order>
               <file>${basedir}/importOrder</file>
             </importOrder-->
          </java>
        </configuration>
        <executions>
          <execution>
            <id>apply</id>
            <phase>validate</phase>
            <goals>
              <goal>apply</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.9.0.2155</version>
      </plugin>

    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-all</artifactId>
        <version>${grpc.version}</version>
        <exclusions>
          <!-- do not use protobuf-lite, use protobuf-java -->
          <exclusion>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-lite</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-core</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-api</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-context</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-census</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-stub</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-auth</artifactId>
        <version>${grpc.version}</version>
      </dependency>

      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
      </dependency>

      <dependency>
        <groupId>com.google.auto.service</groupId>
        <artifactId>auto-service</artifactId> 
        <version>${autoservice.version}</version>
        <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
      </dependency>

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

      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.1</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.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>

    </dependencies>

  </dependencyManagement>


</project>

