<?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>
    <artifactId>ratis</artifactId>
    <groupId>org.apache.ratis</groupId>
    <version>2.2.0</version>
  </parent>

  <artifactId>ratis-logservice</artifactId>
  <name>Apache Ratis LogService</name>

  <build>
    <extensions>
      <!-- Use os-maven-plugin to initialize the "os.detected" properties -->
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.5.0.Final</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <!-- disable all javac warnings for shaded sources -->
            <arg>-Xlint:none</arg>
            <arg>-XDignore.symbol.file</arg>
          </compilerArgs>
          <showWarnings>false</showWarnings>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration/>
      </plugin>
      <!-- Make a jar and put the sources in the jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <skipAssembly>false</skipAssembly>
          <tarLongFileMode>gnu</tarLongFileMode>
          <descriptors>
            <descriptor>src/assembly/assembly.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*.proto</include>
          </includes>
          <protocArtifact>
            com.google.protobuf:protoc:${shaded.protobuf.version}:exe:${os.detected.classifier}
          </protocArtifact>
          <!-- Place these in a location that compiler-plugin is already looking -->
          <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
          <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution -->
          <clearOutputDirectory>false</clearOutputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>compile-protobuf</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <basedir>${project.build.directory}/generated-sources/org/apache/ratis/logservice/proto</basedir>
          <includes>
            <include>**/*.java</include>
          </includes>
          <replacements>
            <replacement>
              <token>([^\.])com.google</token>
              <value>$1org.apache.ratis.thirdparty.com.google</value>
            </replacement>
            <replacement>
              <token>([^\.])io.grpc</token>
              <value>$1org.apache.ratis.thirdparty.io.grpc</value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <configuration>
          <excludeFilterFile>${project.basedir}/dev-support/findbugsExcludeFile.xml</excludeFilterFile>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>
                      com.google.code.maven-replacer-plugin
                    </groupId>
                    <artifactId>replacer</artifactId>
                    <versionRange>
                      [1.5.3,)
                    </versionRange>
                    <goals>
                      <goal>replace</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <!-- Ratis dependencies -->
    <dependency>
      <artifactId>ratis-proto</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>
    <dependency>
      <artifactId>ratis-common</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>
    <dependency>
      <artifactId>ratis-client</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>
    <dependency>
      <artifactId>ratis-server</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>
    <dependency>
      <artifactId>ratis-grpc</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>
    <dependency>
      <artifactId>ratis-netty</artifactId>
      <groupId>org.apache.ratis</groupId>
    </dependency>

    <!-- Hadoop dependencies -->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- CLI dependencies -->
    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jline</groupId>
      <artifactId>jline</artifactId>
    </dependency>
    <!-- Third-party dependencies -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <!-- Test Ratis dependencies -->
    <dependency>
      <artifactId>ratis-netty</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <artifactId>ratis-grpc</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <artifactId>ratis-server</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <artifactId>ratis-common</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <artifactId>ratis-client</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <artifactId>ratis-hadoop</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <artifactId>ratis-hadoop</artifactId>
      <groupId>org.apache.ratis</groupId>
      <scope>test</scope>
      <type>test-jar</type>
    </dependency>
    <!-- Test third-party dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>


    <!-- Needed for Archive log reader and writer testing-->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>${hadoop.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>${hadoop.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>${hadoop.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version}</version>
      <scope>test</scope>
      <type>test-jar</type>
      <exclusions>
        <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-jvm</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.github.spotbugs</groupId>
      <artifactId>spotbugs-annotations</artifactId>
      <optional>true</optional>
    </dependency>
  </dependencies>
</project>
