<!--
  ~ Copyright 2019 ABSA Group Limited
  ~ 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

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

    <organization>
        <name>ABSA Group Limited</name>
        <url>https://www.absa.africa</url>
    </organization>

    <name>ABSA Commons</name>
    <description>Selection of useful reusable components</description>
    <inceptionYear>2019</inceptionYear>
    <url>https://absaoss.github.io/commons/</url>

    <developers>
        <developer>
            <id>wajda</id>
            <name>Oleksandr Vayda</name>
            <timezone>Europe/Prague</timezone>
            <url>https://github.com/wajda</url>
        </developer>
    </developers>

    <groupId>za.co.absa.commons</groupId>
    <artifactId>commons_2.12</artifactId>
    <version>1.0.0</version>

    <properties>
        <scm.url>http://github.com/AbsaOSS/commons/tree/master</scm.url>
        <scm.connection>scm:git:git://github.com/AbsaOSS/commons.git</scm.connection>
        <scm.developerConnection>scm:git:ssh://github.com/AbsaOSS/commons.git</scm.developerConnection>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <default.scala.binary.version>2.11</default.scala.binary.version>
        <default.scala.version>${scala_2.11.version}</default.scala.version>
        <default.class-graph.version>${class-graph-112.version}</default.class-graph.version>
        <default.json4s.version>${json4s-35.version}</default.json4s.version>
        <default.jackson.version>${jackson-26.version}</default.jackson.version>

        <!-- Json4s versions -->

        <json4s-35.version>3.5.5</json4s-35.version>
        <json4s-37.version>3.7.0-M11</json4s-37.version>
        <json4s.version>${default.json4s.version}</json4s.version>

        <!-- Jackson version -->

        <jackson-26.version>2.6.7.4</jackson-26.version>
        <jackson-210.version>2.10.0</jackson-210.version>
        <jackson-212.version>2.12.0</jackson-212.version>
        <jackson.version>${default.jackson.version}</jackson.version>

        <!-- Class-Graph versions -->

        <class-graph-112.version>1.12.5</class-graph-112.version>
        <class-graph-113.version>1.13.3</class-graph-113.version>
        <class-graph.version>${default.class-graph.version}</class-graph.version>

        <!-- Scala versions -->

        <scala_2.11.version>2.11.12</scala_2.11.version>
        <scala_2.12.version>2.12.15</scala_2.12.version>
        <scala_2.13.version>2.13.7</scala_2.13.version>

        <!-- Controlled by `scala-cross-build` plugin -->
        <scala.version>2.12.15</scala.version>
        <scala.binary.version>2.12</scala.binary.version>
    </properties>

    <scm>
        <url>${scm.url}</url>
        <connection>${scm.connection}</connection>
        <developerConnection>${scm.developerConnection}</developerConnection>
        <tag>release/1.0.0</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>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.binary.version}</artifactId>
            <version>3.1.0</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-jackson_${scala.binary.version}</artifactId>
            <version>${json4s.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-native_${scala.binary.version}</artifactId>
            <version>${json4s.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-ext_${scala.binary.version}</artifactId>
            <version>${json4s.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.7</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.10</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.scala-graph</groupId>
            <artifactId>graph-core_${scala.binary.version}</artifactId>
            <version>${class-graph.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.31</version>
            <optional>true</optional>
        </dependency>

        <!-- Test scope dependencies -->

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.2.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalatestplus</groupId>
            <artifactId>mockito-1-10_${scala.binary.version}</artifactId>
            <version>3.1.0.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-dist</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library-all</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scalap</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-actors</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-compiler</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-reflect</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <args>
                        <arg>-feature</arg>
                        <arg>-deprecation</arg>
                        <arg>-unchecked</arg>
                        <arg>-Ywarn-numeric-widen</arg>
                    </args>
                </configuration>
                <executions>
                    <execution>
                        <id>scala-compile</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.wajda</groupId>
                <artifactId>scala-cross-build-maven-plugin</artifactId>
                <version>0.2.2</version>
                <configuration>
                    <defaultScalaBinaryVersion>${default.scala.binary.version}</defaultScalaBinaryVersion>
                    <defaultScalaVersion>${default.scala.version}</defaultScalaVersion>
                    <generatePomBackupFiles>false</generatePomBackupFiles>
                </configuration>
            </plugin>
            <plugin>
                <!-- disable surefire -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <!-- enable scalatest -->
                <groupId>com.github.cerveada</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <junitxml>.</junitxml>
                    <filereports>WDF TestSuite.txt</filereports>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>4.3.1</version>
                </plugin>
                <plugin>
                    <groupId>com.github.cerveada</groupId>
                    <artifactId>scalatest-maven-plugin</artifactId>
                    <version>2.0.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.rat</groupId>
                    <artifactId>apache-rat-plugin</artifactId>
                    <version>0.13</version>
                </plugin>
                <plugin>
                    <groupId>org.spurint.maven.plugins</groupId>
                    <artifactId>mima-maven-plugin</artifactId>
                    <version>0.8.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>scala-2.11</id>
            <properties>
                <scala.binary.version>2.11</scala.binary.version>
                <scala.version>${scala_2.11.version}</scala.version>
                <class-graph.version>${class-graph-112.version}</class-graph.version>
                <json4s.version>${json4s-35.version}</json4s.version>
                <jackson.version>${jackson-26.version}</jackson.version>
            </properties>
        </profile>

        <profile>
            <id>scala-2.12</id>
            <properties>
                <scala.binary.version>2.12</scala.binary.version>
                <scala.version>${scala_2.12.version}</scala.version>
                <class-graph.version>${class-graph-112.version}</class-graph.version>
                <json4s.version>${json4s-37.version}</json4s.version>
                <jackson.version>${jackson-210.version}</jackson.version>
            </properties>
        </profile>

        <profile>
            <id>scala-2.13</id>
            <properties>
                <scala.binary.version>2.13</scala.binary.version>
                <scala.version>${scala_2.13.version}</scala.version>
                <class-graph.version>${class-graph-113.version}</class-graph.version>
                <json4s.version>${json4s-37.version}</json4s.version>
                <jackson.version>${jackson-212.version}</jackson.version>
            </properties>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <configuration>
                            <tagNameFormat>release/@{project.version}</tagNameFormat>
                            <providerImplementations>
                                <git>jgit</git>
                            </providerImplementations>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.scm</groupId>
                                <artifactId>maven-scm-provider-jgit</artifactId>
                                <version>1.11.1</version>
                            </dependency>
                            <dependency>
                                <groupId>org.eclipse.jgit</groupId>
                                <artifactId>org.eclipse.jgit</artifactId>
                                <version>5.2.1.201812262042-r</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>license-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludes>
                                <exclude>**/*.json</exclude>
                                <exclude>dependency-reduced-pom.xml</exclude>
                                <exclude>.sonarcloud.properties</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>mima</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.spurint.maven.plugins</groupId>
                        <artifactId>mima-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>check-abi</id>
                                <goals>
                                    <goal>check-abi</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>doc-jar</goal>
                                </goals>
                                <configuration>
                                    <args>
                                        <arg>-nobootcp</arg>
                                    </args>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                            <autoDropAfterRelease>true</autoDropAfterRelease>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
