<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">

  <!--
  CHANGELOG (significant changes)
  5.10:  
    JDK 1.8 support branch for 4.3.10 with artifactory changes
  5.9:
    Revert S3 repo changes in forge-parent
  5.8:
    Replacing S3 with nexus repos
    Explicitly adding nexus snapshot repos, allows building without a settings.xml
  5.7:
    correcting forge-plugin exclude pattern
  5.6:
    Cleaner plugins and new plugin version vars for downstream
  5.5:
    Remove surefire default execution instead of passing skip to it
  5.2:
    Moving maven-forge-plugin default test executions to pluginManagement
    Adding integration test execution and excluding **/*IT.java
  5.1:
    Added nexus-staging-maven-plugin
  5.0:
    Removed 3rd party deps in favor of terracotta-thirdparty-bom-4.x project
  4.20:
    New maven-forge-plugin (1.2.40) with corrected build-info support
  4.19:
    New maven-forge-plugin (1.2.34) with git build-info support
  4.18:
    Adding snapshot repos
  4.17:
    Switched to https:// for repositories, removed reflector
  4.16:
    New maven-forge-plugin (correctly sets JAVA_HOME)
    Removed dependencies as this is the responsibility of child poms
    Updated versions of commons-beanutils and jetty
  4.15:
    Implicit execution of maven-forge-plugin,
      projects no longer need to specify it for tests to work.
  4.13:
    Disabled junit (in favor of maven-forge-plugin)
    Configurable JDK version/vendor for tests
  4.12:
    Removed finder

  4.x:
    Default JDK is now 1.8 and plugin versions are adjusted accordingly
    (3.x remains on 1.6 and supports old plugins)
-->

  <modelVersion>4.0.0</modelVersion>
  <organization>
    <name>Terracotta, Inc.</name>
    <url>http://www.terracotta.org/</url>
  </organization>

  <groupId>org.terracotta.forge</groupId>
  <artifactId>forge-parent</artifactId>
  <version>5.10</version>
  <packaging>pom</packaging>

  <name>forge-parent</name>
  <description>Parent POM for Terracotta projects</description>

  <modules>
    <module>forge-parent-ee</module>
  </modules>

  <properties>
    <!-- NOTE: to override these when using maven release plugin use this format:
      -Darguments=-Djava.build.version=9 -->
    <java.build.version>8</java.build.version>
    <!-- The vendor value to look for in toolchains.xml -->
    <java.build.vendor>zulu</java.build.vendor>
    <maven-forge-plugin.version>1.2.40</maven-forge-plugin.version>
    <java.test.version>${java.build.version}</java.test.version>
    <java.test.vendor>${java.build.vendor}</java.test.vendor>
    <maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
    <deploy-plugin.version>3.1.4</deploy-plugin.version>
    <surefire-plugin.version>3.0.0-M4</surefire-plugin.version>
    <failsafe-plugin.version>3.0.0-M4</failsafe-plugin.version>
    <findbugs-plugin.version>3.0.5</findbugs-plugin.version>
    <source-plugin.version>3.1.0</source-plugin.version>
    <checkstyle-plugin.version>3.1.0</checkstyle-plugin.version>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.build.timestamp.format>yyyyMMdd-HHmmss</maven.build.timestamp.format>
    <build.timestamp>${maven.build.timestamp}</build.timestamp>
    <skipTests>false</skipTests>
    <skipCheckstyle>true</skipCheckstyle>
    <skipJavadoc>false</skipJavadoc>
    <skipDeploy>false</skipDeploy>

    <checkstyle-groupId>org.terracotta.checkstyle</checkstyle-groupId>
    <checkstyle-artifactId>terracotta-checkstyle</checkstyle-artifactId>
    <checkstyle-version>1.4</checkstyle-version>
    <checkstyle-config-file>terracotta-checkstyle/checkstyle.xml</checkstyle-config-file>
    <checkstyle-header-file>terracotta-checkstyle/header.txt</checkstyle-header-file>

    <artifactory-context-url>https://na.artifactory.swg-devops.com/artifactory</artifactory-context-url>
    <artifactory-repokey-releases>hyc-webmriab-team-tc01-os-releases-maven-local</artifactory-repokey-releases>
    <artifactory-repokey-snapshots>hyc-webmriab-team-tc01-os-snapshots-maven-local</artifactory-repokey-snapshots>
    <artifactory-build-name-prefix>hyc-webmriab-team-tc01/terracotta-v4</artifactory-build-name-prefix>

  </properties>

  <profiles>
    <profile>
      <id>patch</id>
      <distributionManagement>
        <repository>
          <id>terracotta-patches</id>
          <name>Terracotta Patches Repository</name>
          <url>${terracotta-patches-url}</url>
        </repository>
      </distributionManagement>
    </profile>

    <profile>
      <!-- 
        In this (default) mode, 
        mvn deploy uses artifactory plugin to create build-info.
        This requires setting artifactory-build-name in child pom.
        and Environment variables for credentials at deploy time
        To disable, pass -Ddirect-deploy
      -->
      <id>artifactory</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>!direct-deploy</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.jfrog.buildinfo</groupId>
              <artifactId>artifactory-maven-plugin</artifactId>
              <version>3.6.1</version>
              <executions>
                <execution>
                  <id>build-info</id>
                  <goals>
                    <goal>publish</goal>
                  </goals>
                  <configuration>
                    <artifactory>
                      <includeEnvVars>true</includeEnvVars>
                      <envVarsExcludePatterns>
                        *password*,*secret*,*key*,*token*,*passphrase*</envVarsExcludePatterns>
                      <envVarsIncludePatterns>*os*</envVarsIncludePatterns>
                      <timeoutSec>60</timeoutSec>
                    </artifactory>
                    <buildInfo>
                      <!-- 
                      <agentName>..</agentName>
								      <agentVersion>..</agentVersion> 
                      -->
                      <buildName>${artifactory-build-name-prefix}/${artifactory-build-name}</buildName>
                      <buildNumber>${buildnumber}</buildNumber>
                      <buildUrl>{{BUILD_URL}}</buildUrl>
                      <!-- If you'd like to associate the published build-info with a
								JFrog Project, add the project key here -->
                      <project>{{ARTIFACTORY_PROJECT}}</project>

                      <!-- 
                      <buildNumbersNotToDelete></buildNumbersNotToDelete>
                      <buildRetentionMaxDays></buildRetentionMaxDays>
                      <buildRetentionCount></buildRetentionCount>
                       -->
                      <!-- may need "deleteBuildArtifacts" also, but not in docs -->
                      <!-- 
								      <principal>..</principal> 
                      -->
                    </buildInfo>
                    <deployProperties>
                      <maven>awesome</maven>
                    </deployProperties>
                    <publisher>
                      <contextUrl>${artifactory-context-url}</contextUrl>
                      <username>{{ARTIFACTORY_DEPLOY_USERNAME}}</username>
                      <password>{{ARTIFACTORY_DEPLOY_PASSWORD}}</password>
                      <excludePatterns>${artifactory-deploy-exclude-patterns}</excludePatterns>
                      <includePatterns>${artifactory-deploy-include-patterns}</includePatterns>
                      <repoKey>${artifactory-repokey-releases}</repoKey>
                      <snapshotRepoKey>${artifactory-repokey-snapshots}</snapshotRepoKey>

                      <publishArtifacts>true</publishArtifacts>
                      <publishBuildInfo>true</publishBuildInfo>

                      <filterExcludedArtifactsFromBuild>${artifactory-deploy-filter-excluded}</filterExcludedArtifactsFromBuild>
                      <!-- If true build information published to Artifactory will include
								implicit project as well as build-time dependencies -->
                      <recordAllDependencies>true</recordAllDependencies>
                      <!-- Minimum file size in KB for which the plugin performs checksum
								deploy optimization. Default: 10. Set to 0 to disable uploading
								files with checksum that already exists in Artifactory. -->
                      <minChecksumDeploySizeKb>10</minChecksumDeploySizeKb>
                    </publisher>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.jfrog.buildinfo</groupId>
            <artifactId>artifactory-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- 
      mvn deploy directly uploads without artifactory plugin.
      To enable: -Ddirect-deploy
      Unlike nexus-staging plugins, artifactory plugin is not compatible
      with deploy plugin, so they have to be kept in separate profiles.
      Using this mode will require configuring "server" elements in 
      settings.xml with credentials 
      for every named repo in distributionManagement
      -->
      <id>deploy-direct</id>
      <activation>
        <property>
          <name>direct-deploy</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-deploy-plugin</artifactId>
              <version>${deploy-plugin.version}</version>
              <configuration>
                <skip>${skipDeploy}</skip>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <repository>
          <id>${artifactory-repokey-releases}</id>
          <name>Terracotta OS Releases Repository</name>
          <url>${artifactory-context-url}/${artifactory-repokey-releases}</url>
        </repository>
        <snapshotRepository>
          <id>${artifactory-repokey-snapshots</id>
          <uniqueVersion>false</uniqueVersion>
          <name>Terracotta OS Snapshots Repository</name>
          <url>${artifactory-context-url}/${artifactory-repokey-snapshots}</url>
        </snapshotRepository>
      </distributionManagement>
    </profile>
  </profiles>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${source-plugin.version}</version>
          <configuration>
            <forceCreation>true</forceCreation>
          </configuration>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.12.0</version>
          <configuration>
            <aggregate>true</aggregate>
            <targetJdk>${java.build.version}</targetJdk>
          </configuration>
        </plugin>
        <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>8.24</version>
            </dependency>
            <dependency>
              <groupId>${checkstyle-groupId}</groupId>
              <artifactId>${checkstyle-artifactId}</artifactId>
              <version>${checkstyle-version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <configLocation>${checkstyle-config-file}</configLocation>
            <headerLocation>${checkstyle-header-file}</headerLocation>
            <encoding>UTF-8</encoding>
            <consoleOutput>true</consoleOutput>
            <failsOnError>false</failsOnError>
            <failOnViolation>false</failOnViolation>
            <includeTestSourceDirectory>false</includeTestSourceDirectory>
            <enableRulesSummary>true</enableRulesSummary>
            <linkXRef>false</linkXRef>
            <skip>${skipCheckstyle}</skip>
          </configuration>
          <executions>
            <execution>
              <id>run-checkstyle</id>
              <phase>validate</phase>
              <goals>
                <goal>checkstyle</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <configuration>
            <source>${java.build.version}</source>
            <target>${java.build.version}</target>
            <fork>true</fork>
            <meminitial>128m</meminitial>
            <maxmem>512m</maxmem>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.terracotta</groupId>
          <artifactId>maven-forge-plugin</artifactId>
          <version>${maven-forge-plugin.version}</version>
          <!-- Reasonable defaults: all non *IT.java in surefire, *IT.java in failsafe -->
          <!-- This also enables failsafe for all projects -->
          <!-- Also see system-tests profile that changes this behavior -->
          <executions>
            <execution>
              <id>default-test</id>
              <goals>
                <goal>test</goal>
              </goals>
              <configuration>
                <excludes>
                  <exclude>**/*IT.java</exclude>
                </excludes>
              </configuration>
            </execution>
            <execution>
              <id>default-integration-test</id>
              <goals>
                <goal>integration-test</goal>
              </goals>
            </execution>
            <execution>
              <id>default-verify</id>
              <goals>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <jdk>
              <version>1.${java.test.version}</version>
              <vendor>${java.test.vendor}</vendor>
            </jdk>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <source>8</source>
            <skip>${skipJavadoc}</skip>
            <doclint>html,reference,syntax</doclint>
            <quiet>true</quiet>
            <links>
              <link>https://docs.oracle.com/javase/8/docs/api/</link>
            </links>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!-- NOTE: no default executions defined for surefire/failsafe since we use
        maven-forge-plugin -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${surefire-plugin.version}</version>
          <executions>
            <execution>
              <id>default-test</id>
              <phase>none</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${failsafe-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skipITs>${skipTests}</skipITs>
            <reuseForks>false</reuseForks>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-toolchains-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>${findbugs-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.1.2</version>
        <configuration>
          <archive>
            <manifestEntries>
              <BuildInfo-Timestamp>${build.timestamp}</BuildInfo-Timestamp>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <!-- Ensure that we are compiling with the correct JDK even if we are running on a later
      version -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-toolchains-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <goals>
              <goal>toolchain</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <toolchains>
            <jdk>
              <version>1.${java.build.version}</version>
              <vendor>${java.build.vendor}</vendor>
            </jdk>
          </toolchains>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[${java.build.version},)</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>${findbugs-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <repositories>
    <repository>
      <id>terracotta-snapshots</id>
      <url>https://snapshots.terracotta.org/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
    <repository>
      <id>terracotta-releases</id>
      <url>https://repo.terracotta.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>terracotta-snapshots</id>
      <url>https://snapshots.terracotta.org/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <id>terracotta-releases</id>
      <url>https://repo.terracotta.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <scm>
    <connection>scm:git:git@github.com:Terracotta-OSS/forge-parent.git</connection>
    <developerConnection>scm:git:https://github.com/Terracotta-OSS/forge-parent.git</developerConnection>
  </scm>
</project>