<?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. See accompanying LICENSE file.
-->
<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>

  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>18</version>
    <relativePath /> <!-- resolve from repository -->
  </parent>

  <artifactId>ratis</artifactId>
  <groupId>org.apache.ratis</groupId>
  <version>1.1.0-f60fb15-SNAPSHOT</version>
  <name>Apache Ratis</name>
  <packaging>pom</packaging>
  <description>
    Apache Ratis is an open source java implementation for RAFT consensus protocol
  </description>
  <url>https://ratis.apache.org/</url>
  <inceptionYear>2017</inceptionYear>

  <distributionManagement>
    <repository>
      <id>${distMgmtStagingId}</id>
      <name>${distMgmtStagingName}</name>
      <url>${distMgmtStagingUrl}</url>
    </repository>
    <snapshotRepository>
      <id>${distMgmtSnapshotsId}</id>
      <name>${distMgmtSnapshotsName}</name>
      <url>${distMgmtSnapshotsUrl}</url>
    </snapshotRepository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>${distMgmtSnapshotsId}</id>
      <name>${distMgmtSnapshotsName}</name>
      <url>${distMgmtSnapshotsUrl}</url>
    </repository>
    <repository>
      <id>repository.jboss.org</id>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

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

  <modules>
    <module>ratis-docs</module>
    <module>ratis-proto</module>
    <module>ratis-common</module>
    <module>ratis-client</module>
    <module>ratis-server-api</module>
    <module>ratis-server</module>
    <module>ratis-resource-bundle</module>
    <module>ratis-grpc</module>
    <module>ratis-netty</module>
    <module>ratis-hadoop</module>

    <module>ratis-test</module>

    <module>ratis-examples</module>
    <module>ratis-replicated-map</module>
    <module>ratis-logservice</module>
    <module>ratis-metrics</module>
    <module>ratis-tools</module>
    <module>ratis-assembly</module>
  </modules>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>https://repository.apache.org/snapshots/</url>
    </pluginRepository>
  </pluginRepositories>

  <scm>
    <connection>scm:git:git://git.apache.org/ratis.git</connection>
    <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/ratis.git</developerConnection>
    <url>https://git-wip-us.apache.org/repos/asf?p=ratis.git</url>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>JIRA</system>
    <url>http://issues.apache.org/jira/browse/RATIS</url>
  </issueManagement>

  <!--<ciManagement> TODO
    <system>Jenkins</system>
    <url>http://builds.apache.org/job/Ratis-Master/</url>
  </ciManagement>-->

  <mailingLists>
    <mailingList>
      <name>User List</name>
      <subscribe>user-subscribe@ratis.apache.org</subscribe>
      <unsubscribe>user-unsubscribe@ratis.apache.org</unsubscribe>
      <post>user@ratis.apache.org</post>
      <archive>https://lists.apache.org/list.html?user@ratis.apache.org</archive>
      <otherArchives>
        <otherArchive>http://mail-archives.apache.org/mod_mbox/ratis-user/</otherArchive>
      </otherArchives>
    </mailingList>
    <mailingList>
      <name>Developer List</name>
      <subscribe>dev-subscribe@ratis.apache.org</subscribe>
      <unsubscribe>dev-unsubscribe@ratis.apache.org</unsubscribe>
      <post>dev@ratis.apache.org</post>
      <archive>https://lists.apache.org/list.html?dev@ratis.apache.org</archive>
      <otherArchives>
        <otherArchive>http://mail-archives.apache.org/mod_mbox/ratis-dev/</otherArchive>
      </otherArchives>
    </mailingList>
    <mailingList>
      <name>Commits List</name>
      <subscribe>commits-subscribe@ratis.apache.org</subscribe>
      <unsubscribe>commits-unsubscribe@ratis.apache.org</unsubscribe>
      <archive>https://lists.apache.org/list.html?commits@ratis.apache.org</archive>
      <otherArchives>
        <otherArchive>http://mail-archives.apache.org/mod_mbox/ratis-commits/</otherArchive>
      </otherArchives>
    </mailingList>
    <mailingList>
      <name>Issues List</name>
      <subscribe>issues-subscribe@ratis.apache.org</subscribe>
      <unsubscribe>issues-unsubscribe@ratis.apache.org</unsubscribe>
      <archive>https://lists.apache.org/list.html?issues@ratis.apache.org</archive>
      <otherArchives>
        <otherArchive>http://mail-archives.apache.org/mod_mbox/ratis-issues/</otherArchive>
      </otherArchives>
    </mailingList>
  </mailingLists>

  <developers>
    <!-- TODO: Add developers -->
  </developers>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <!-- where to find the generated LICENSE files -->
    <license.aggregate.path>
      ${project.build.directory}/maven-shared-archive-resources/META-INF/LICENSE
    </license.aggregate.path>
    <license.bundles.dependencies>false</license.bundles.dependencies>

    <!-- Maven plugin versions -->
    <maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
    <maven-assembly-plugin.version>3.1.1</maven-assembly-plugin.version>
    <maven-bundle-plugin.version>2.5.3</maven-bundle-plugin.version>
    <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
    <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
    <maven-clover2-plugin.version>3.3.0</maven-clover2-plugin.version>
    <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
    <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
    <maven-deploy-plugin.version>2.8.1</maven-deploy-plugin.version>
    <maven-install-plugin.version>3.0.0-M1</maven-install-plugin.version>
    <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
    <maven-pdf-plugin.version>1.2</maven-pdf-plugin.version>
    <maven-resources-plugin.version>2.6</maven-resources-plugin.version>
    <maven-shade-plugin.version>3.2.1</maven-shade-plugin.version>
    <maven-site-plugin.version>3.5</maven-site-plugin.version>
    <maven-source-plugin.version>2.3</maven-source-plugin.version>
    <maven-stylus-skin.version>1.5</maven-stylus-skin.version>
    <maven-surefire-plugin.version>3.0.0-M1</maven-surefire-plugin.version>
    <maven-remote-resources-plugin.version>1.6.0</maven-remote-resources-plugin.version>
    <protobuf-maven-plugin.version>0.5.1</protobuf-maven-plugin.version>
    <license-maven-plugin.version>1.19</license-maven-plugin.version>
    <copy-rename-maven-plugin.version>1.0</copy-rename-maven-plugin.version>



    <!--
      ! Can be removed if changing to ASF parent version 19
    -->
    <apache-rat-plugin.version>0.13</apache-rat-plugin.version>
    <build-helper-maven-plugin.version>1.9</build-helper-maven-plugin.version>
    <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
    <spotbugs.version>4.2.1</spotbugs.version>
    <spotbugs-plugin.version>4.2.0</spotbugs-plugin.version>
    <wagon-ssh.version>1.0</wagon-ssh.version>

    <distMgmtSnapshotsId>apache.snapshots.https</distMgmtSnapshotsId>
    <distMgmtSnapshotsName>Apache Development Snapshot Repository</distMgmtSnapshotsName>
    <distMgmtSnapshotsUrl>https://repository.apache.org/content/repositories/snapshots</distMgmtSnapshotsUrl>
    <distMgmtStagingId>apache.staging.https</distMgmtStagingId>
    <distMgmtStagingName>Apache Release Distribution Repository</distMgmtStagingName>
    <distMgmtStagingUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distMgmtStagingUrl>

    <shell-executable>bash</shell-executable>

    <hadoop.version>3.1.1</hadoop.version>
    <hadoop-maven-plugins.version>${hadoop.version}</hadoop-maven-plugins.version>

    <!-- define the Java language version used by the compiler -->
    <javac.version>1.8</javac.version>
    <java.min.version>${javac.version}</java.min.version>
    <maven.min.version>3.3.9</maven.min.version>

    <!-- Contains all shaded thirdparty dependencies -->
    <ratis.thirdparty.version>0.6.0</ratis.thirdparty.version>

    <!-- Need these for the protobuf compiler. *MUST* match what is in ratis-thirdparty -->
    <shaded.protobuf.version>3.12.0</shaded.protobuf.version>
    <shaded.grpc.version>1.33.0</shaded.grpc.version>

    <hadoop.protobuf.version>2.5.0</hadoop.protobuf.version>

    <!-- Test properties -->
    <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
    <test.exclude.pattern>_</test.exclude.pattern>
    <!-- number of threads/forks to use when running tests in parallel, see parallel-tests profile -->
    <testsThreadCount>4</testsThreadCount>

    <checkstyle.version>8.18</checkstyle.version>

    <!--metrics-->
    <dropwizard.version>3.2.5</dropwizard.version>

    <!-- commons lang version -->
    <commons.lang.version>3.8.1</commons.lang.version>

    <!-- LOG4J version -->
    <log4j.version>1.2.17</log4j.version>

  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- Internal dependencies -->
      <dependency>
        <artifactId>ratis-docs</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <artifactId>ratis-client</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-client</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-common</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-common</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-examples</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-examples</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <artifactId>ratis-experiments</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
       <artifactId>ratis-metrics</artifactId>
       <groupId>org.apache.ratis</groupId>
       <version>${project.version}</version>
      </dependency>
      <dependency>
       <artifactId>ratis-metrics</artifactId>
       <groupId>org.apache.ratis</groupId>
       <version>${project.version}</version>
       <type>test-jar</type>
       <scope>test</scope>
      </dependency>
      <dependency>
        <artifactId>ratis-tools</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-tools</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <artifactId>ratis-grpc</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-grpc</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <artifactId>ratis-hadoop</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-hadoop</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-netty</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-netty</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-proto</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <artifactId>ratis-replicated-map</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-replicated-map</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-server-api</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <artifactId>ratis-server</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-server</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <artifactId>ratis-test</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-test</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.ratis</groupId>
        <artifactId>ratis-logservice</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <artifactId>ratis-logservice</artifactId>
        <groupId>org.apache.ratis</groupId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.ratis</groupId>
        <artifactId>ratis-thirdparty-misc</artifactId>
        <version>${ratis.thirdparty.version}</version>
      </dependency>

      <!-- External dependencies -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.29</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <scope>test</scope>
        <version>1.7.29</version>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
      </dependency>

      <dependency>
        <groupId>com.beust</groupId>
        <artifactId>jcommander</artifactId>
        <version>1.72</version>
      </dependency>

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

      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-jvm</artifactId>
        <version>${dropwizard.version}</version>
      </dependency>

      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-ganglia</artifactId>
        <version>${dropwizard.version}</version>
      </dependency>

      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>3.5.15</version>
      </dependency>
	    <dependency>
	      <groupId>org.jline</groupId>
	      <artifactId>jline</artifactId>
	      <version>3.9.0</version>
	    </dependency>

      <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>1.2</version>
      </dependency>

      <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>${spotbugs.version}</version>
        <optional>true</optional>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.5.0.Final</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven-shade-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.xolstice.maven.plugins</groupId>
          <artifactId>protobuf-maven-plugin</artifactId>
          <version>${protobuf-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build-helper-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-remote-resources-plugin</artifactId>
          <version>${maven-remote-resources-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${license-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>com.coderplus.maven.plugins</groupId>
          <artifactId>copy-rename-maven-plugin</artifactId>
          <version>${copy-rename-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven-install-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <additionalJOptions>
              <additionalJOption>-Xmaxwarns</additionalJOption>
              <additionalJOption>10000</additionalJOption>
              <additionalJOption>-Xdoclint:-missing</additionalJOption>
            </additionalJOptions>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>${spotbugs-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>com.github.spotbugs</groupId>
              <artifactId>spotbugs</artifactId>
              <version>${spotbugs.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <fork>true</fork>
            <maxHeap>2048</maxHeap>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven-resources-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${exec-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pdf-plugin</artifactId>
          <version>${maven-pdf-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-maven-plugins</artifactId>
          <version>${hadoop-maven-plugins.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <configuration>
            <rules>
              <requireMavenVersion>
                <version>[${maven.min.version},)</version>
              </requireMavenVersion>
              <requireJavaVersion>
                <version>[${java.min.version},)</version>
              </requireJavaVersion>
            </rules>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${maven-assembly-plugin.version}</version>
          <configuration>
            <!--Defer to the ratis-assembly sub-module.  It does all assembly-->
            <skipAssembly>true</skipAssembly>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>${javac.version}</source>
            <target>${javac.version}</target>
            <fork>true</fork>
            <meminitial>512m</meminitial>
            <maxmem>2048m</maxmem>
            <showDeprecation>false</showDeprecation>
            <useIncrementalCompilation>false</useIncrementalCompilation>
            <compilerArgs>
              <arg>-Xlint:all,-options,-path</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <!-- Make a jar and put the sources in the jar.
        In the parent pom, so submodules will do the right thing. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- General configuration for submodules who want to build a test jar -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
          <executions>
            <execution>
              <phase>prepare-package</phase>
              <goals>
                <!--This goal will install a -test.jar when we do install
                    See http://maven.apache.org/guides/mini/guide-attached-tests.html
                 -->
                <goal>test-jar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skipIfEmpty>true</skipIfEmpty>
            <excludes>
              <exclude>log4j.properties</exclude>
              <exclude>*.jar</exclude>
            </excludes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
          <configuration>
            <failIfNoTests>false</failIfNoTests>
            <reuseForks>false</reuseForks>
            <trimStackTrace>false</trimStackTrace>
            <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
            <argLine>-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError</argLine>
            <systemPropertyVariables>
              <ratis.log.dir>${project.build.directory}/log</ratis.log.dir>
              <ratis.tmp.dir>${project.build.directory}/tmp</ratis.tmp.dir>

              <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
            </systemPropertyVariables>
            <includes>
              <include>**/Test*.java</include>
            </includes>
            <excludes>
              <exclude>**/Test*$*.java</exclude>
              <exclude>${test.exclude.pattern}</exclude>
            </excludes>
            <properties>
              <property>
                <name>listener</name>
                <value>org.apache.ratis.JUnitRunListener</value>
              </property>
            </properties>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <configuration>
            <!--You need this profile. It'll sign your artifacts.
                I'm not sure if this config. actually works though.
                I've been specifying -Papache-release on the command-line
             -->
            <releaseProfiles>apache-release</releaseProfiles>
            <!--This stops our running tests for each stage of maven release.
                But it builds the test jar.  From SUREFIRE-172.
              -->
            <arguments>-Dmaven.test.skip.exec ${arguments}</arguments>
            <goals>${goals}</goals>
            <pomFileName>pom.xml</pomFileName>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven-deploy-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>${apache-rat-plugin.version}</version>
          <!-- target/ should get picked up from Apache parent pom.. -->
          <configuration>
            <!-- Lets us define more exclusions in child-modules without overriding these -->
            <excludes combine.children="append">
              <exclude>.github/*.md</exclude>
              <exclude>target/*</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${maven-antrun-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven-site-plugin.version}</version>
          <dependencies>
            <dependency><!-- add support for ssh/scp -->
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-ssh</artifactId>
              <version>${wagon-ssh.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>com.atlassian.maven.plugins</groupId>
          <artifactId>maven-clover2-plugin</artifactId>
          <version>${maven-clover2-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>${maven-bundle-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <inherited>false</inherited>
        <executions>
          <execution>
            <id>clean</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>pre-clean</phase>
          </execution>
          <execution>
            <id>default</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <rules>
                <!-- The earliest maven version we verify builds for via ASF Jenkins -->
                <requireMavenVersion>
                  <version>[${maven.min.version},)</version>
                  <message>Maven is out of date.
                    Ratis requires at least version ${maven.min.version} of Maven to properly build from source.
                    You appear to be using an older version. You can use either "mvn -version" or
                    "mvn enforcer:display-info" to verify what version is active.
                  </message>
                </requireMavenVersion>
                <!-- The earliest JVM version we verify builds for via ASF Jenkins -->
                <requireJavaVersion>
                  <version>[${java.min.version},)</version>
                  <message>Java is out of date.
                    Ratis requires at least version ${java.min.version} of the JDK to properly build from source.
                    You appear to be using an older version. You can use either "mvn -version" or
                    "mvn enforcer:display-info" to verify what version is active.
                  </message>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <inherited>true</inherited>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>dev-support/checkstyle.xml</configLocation>
          <failOnViolation>false</failOnViolation>
          <linkXRef>false</linkXRef>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pdf-plugin</artifactId>
        <configuration>
          <outputDirectory>${project.reporting.outputDirectory}
          </outputDirectory>
          <includeReports>false</includeReports>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>create-metadata</goal>
            </goals>
            <configuration>
              <outputDirectory>target/classes</outputDirectory>
              <outputName>ratis-version.properties</outputName>
              <revisionOnScmFailure>Unknown</revisionOnScmFailure>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/target/generated-sources</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>experiments-build</id>
      <activation>
        <property>
          <name>buildExp</name>
        </property>
      </activation>
      <modules>
        <module>ratis-experiments</module>
      </modules>
    </profile>
    <profile>
      <id>os.linux</id>
      <activation>
        <os>
          <family>!Mac</family>
        </os>
      </activation>
      <properties>
        <build.platform>${os.name}-${os.arch}-${sun.arch.data.model}
        </build.platform>
      </properties>
    </profile>
    <profile>
      <id>os.mac</id>
      <activation>
        <os>
          <family>Mac</family>
        </os>
      </activation>
      <properties>
        <build.platform>Mac_OS_X-${sun.arch.data.model}</build.platform>
      </properties>
    </profile>
    <profile>
      <id>native-win</id>
      <activation>
        <os>
          <family>Windows</family>
        </os>
      </activation>
      <properties>
        <!-- We must use this exact string for egd on Windows, because the -->
        <!-- JVM will check for an exact string match on this.  If found, it -->
        <!-- will use a native entropy provider.  This will not really -->
        <!-- attempt to open a file at this path. -->
        <java.security.egd>file:/dev/urandom</java.security.egd>
        <bundle.snappy.in.bin>true</bundle.snappy.in.bin>
        <bundle.openssl.in.bin>true</bundle.openssl.in.bin>
      </properties>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <!-- build javadoc jars per jar for publishing to maven -->
                <id>module-javadocs</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <destDir>${project.build.directory}</destDir>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <!-- builds source jars and attaches them to the project for publishing -->
                <id>ratis-java-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                  <goal>test-jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>negate-license-bundles-property</id>
                <goals>
                  <goal>bsh-property</goal>
                </goals>
                <configuration>
                  <source>skip.license.check = !${license.bundles.dependencies};</source>
                  <properties>
                    <property>skip.license.check</property>
                  </properties>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>extra-enforcer-rules</artifactId>
                <version>1.0-beta-6</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>dist-enforce</id>
                <phase>package</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <enforceBytecodeVersion>
                      <maxJdkVersion>${java.min.version}</maxJdkVersion>
                      <message>Ratis has unsupported dependencies.
                        Ratis requires that all dependencies be compiled with version ${java.min.version} or earlier
                        of the JDK to properly build from source.  You appear to be using a newer dependency. You can use
                        either "mvn -version" or "mvn enforcer:display-info" to verify what version is active.
                        Non-release builds can temporarily build with a newer JDK version by setting the
                        'javac.source' property (eg. mvn -Djavac.source=1.8 clean package).
                      </message>
                    </enforceBytecodeVersion>
                  </rules>
                </configuration>
              </execution>
              <execution>
                <id>check-aggregate-license</id>
                <!-- must check after LICENSE is built at 'generate-resources' -->
                <phase>process-resources</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <evaluateBeanshell>
                      <condition>
                        File license = new File("${license.aggregate.path}");

                        // Beanshell does not support try-with-resources,
                        // so we must close this scanner manually
                        Scanner scanner = new Scanner(license);

                        while (scanner.hasNextLine()) {
                        if (scanner.nextLine().startsWith("ERROR:")) {
                        scanner.close();
                        return false;
                        }
                        }
                        scanner.close();
                        return true;
                      </condition>
                      <message>
                        License errors detected, for more detail find ERROR in
                        ${license.aggregate.path}
                      </message>
                    </evaluateBeanshell>
                  </rules>
                  <skip>${skip.license.check}</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.rat</groupId>
            <artifactId>apache-rat-plugin</artifactId>
            <executions>
              <execution>
                <!-- Execution at the validate lifecycle is good -->
                <id>check-licenses</id>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>grpc-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <includes>
                <include>org.apache.ratis.grpc.**</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>server-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <includes>
                <include>org.apache.ratis.datastream.**</include>
                <include>org.apache.ratis.server.**</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>misc-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>org.apache.ratis.datastream.**</exclude>
                <exclude>org.apache.ratis.grpc.**</exclude>
                <exclude>org.apache.ratis.server.**</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
