<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2020 Terracotta, Inc., a Software AG company.

  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>org.terracotta</groupId>
  <artifactId>terracotta-utilities-parent</artifactId>
  <version>0.0.15</version>
  <packaging>pom</packaging>
  <name>Terracotta Utilities Parent</name>
  <description>Parent POM for the Terracotta Utilities artifacts</description>
  <url>https://github.com/Terracotta-OSS/terracotta-utilities/</url>

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

  <properties>
    <java.version>1.8</java.version>
    <maven.version>3.6.3</maven.version>
    <spotbugs-annotations.version>4.0.2</spotbugs-annotations.version>
    <slf4j.base.version>1.7.32</slf4j.base.version>
    <slf4j.range.version>[${slf4j.base.version},1.7.9999)</slf4j.range.version>
    <logback.base.version>1.2.11</logback.base.version>
    <logback.range.version>[${logback.base.version},1.2.9999)</logback.range.version>
    <hamcrest.version>2.2</hamcrest.version>
    <mokito.version>3.3.3</mokito.version>
    <junit.version>4.12</junit.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <terracotta-os-snapshots-url>http://nexus.terracotta.eur.ad.sag/content/repositories/terracotta-os-snapshots</terracotta-os-snapshots-url>
    <terracotta-os-releases-url>http://nexus.terracotta.eur.ad.sag/content/repositories/terracotta-os-releases</terracotta-os-releases-url>
  </properties>

  <modules>
    <module>port-chooser</module>
    <module>tools</module>
    <module>test-tools</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>${spotbugs-annotations.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.range.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.range.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest</artifactId>
        <version>${hamcrest.version}</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mokito.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
            <compilerArgs>
              <arg>-Xlint:all</arg>
              <arg>-Werror</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.2.0</version>
          <configuration>
            <failOnError>false</failOnError>
            <failOnWarnings>false</failOnWarnings>
            <quiet>true</quiet>
            <author>false</author>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.1.0</version>
          <configuration>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-toolchains-plugin</artifactId>
          <version>3.0.0</version>
          <configuration>
            <toolchains>
              <jdk>
                <version>${java.version}</version>
              </jdk>
            </toolchains>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M3</version>
        </plugin>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M4</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <configLocation>config/checkstyle.xml</configLocation>
            <headerLocation>config/header.txt</headerLocation>
            <propertyExpansion>
              config_loc=${project.basedir}/config/checkstyle
            </propertyExpansion>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.0</version>
        </plugin>

        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>4.0.0</version>
          <configuration>
            <xmlOutput>true</xmlOutput>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.13</version>
          <configuration>
            <excludes>
              <exclude>.mvn/wrapper/maven-wrapper.properties</exclude>
              <exclude>README.md</exclude>
              <exclude>LICENSE-*</exclude>
              <exclude>NOTICE-*</exclude>
              <exclude>src/main/java/org/terracotta/org/junit/**</exclude>
              <exclude>src/test/java/org/terracotta/org/junit/**</exclude>
              <exclude>.github/**</exclude>
            </excludes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.8</version>
          <extensions>true</extensions>
          <configuration>
            <!-- The Base URL of Nexus instance where we want to stage -->
            <nexusUrl>https://oss.sonatype.org</nexusUrl>
            <!-- The server "id" element from settings to use authentication from -->
            <serverId>sonatype-nexus-staging</serverId>
            <skipNexusStagingDeployMojo>${maven.deploy.skip}</skipNexusStagingDeployMojo>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-toolchains-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>toolchain</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <configuration>
          <rules>
            <dependencyConvergence>
              <uniqueVersions>true</uniqueVersions>
            </dependencyConvergence>
            <requireJavaVersion>
              <version>[${java.version},)</version>
            </requireJavaVersion>
            <requireMavenVersion>
              <version>[${maven.version},)</version>
            </requireMavenVersion>
          </rules>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!-- Profile to sign artifacts with a PGP key (using GPG).
           Must be activated for sonatype releases -->
      <id>sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>Terracotta Release Engineer</keyname>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>skipToolchain</id>
      <activation>
        <property>
          <name>skipToolchain</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-toolchains-plugin</artifactId>
            <executions>
              <execution>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <repository>
      <id>sonatype-nexus-staging</id>
      <url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>terracotta-os-snapshots</id>
      <uniqueVersion>false</uniqueVersion>
      <name>Terracotta OS Snapshots Repository</name>
      <url>${terracotta-os-snapshots-url}</url>
    </snapshotRepository>
  </distributionManagement>

  <scm>
    <connection>scm:git:https://github.com/terracotta-oss/terracotta-utilities.git</connection>
    <developerConnection>scm:git:git@github.com:terracotta-oss/terracotta-utilities.git</developerConnection>
    <url>https://github.com/terracotta-oss/terracotta-utilities</url>
  </scm>

  <developers>
    <developer>
      <name>Clifford W Johnson</name>
      <email>clifford.johnson@softwareag.com</email>
      <organization>Terracotta Inc., a wholly-owned subsidiary of Software AG USA, Inc.</organization>
      <organizationUrl>https://terracotta.org</organizationUrl>
    </developer>
  </developers>

</project>