<!--
  ~ Copyright 2017-present Open Networking Foundation
  ~
  ~ 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">
  <artifactId>atomix-raft</artifactId>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Export-Package>
              io.atomix.protocols.raft.*
            </Export-Package>
            <Import-Package>
              !sun.nio.ch,!sun.misc,*
            </Import-Package>
          </instructions>
        </configuration>
        <extensions>true</extensions>
        <groupId>org.apache.felix</groupId>
      </plugin>

      <!-- CHECKSTYLE -->
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>check/.checkstyle.xml</configLocation>
          <encoding>UTF-8</encoding>
          <failOnViolation>true</failOnViolation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <sourceDirectories>
            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
            <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
          </sourceDirectories>
        </configuration>
        <dependencies>
          <dependency>
            <artifactId>zeebe-build-tools</artifactId>
            <groupId>io.zeebe</groupId>
            <version>${zeebe.version}</version>
          </dependency>
        </dependencies>
        <!-- dependency on build tool to reference the checkstyle cfg -->
        <executions>
          <execution>
            <configuration>
            </configuration>
            <goals>
              <goal>check</goal>
            </goals>
            <id>validate-java</id>
            <phase>validate</phase>
          </execution>
        </executions>
        <groupId>org.apache.maven.plugins</groupId>
        <version>${plugin.version.checkstyle}</version>
      </plugin>

      <!-- Google code format plugin -->
      <plugin>
        <artifactId>fmt-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>format</goal>
            </goals>
          </execution>
        </executions>
        <groupId>com.coveo</groupId>
        <version>${plugin.version.fmt}</version>
      </plugin>


    </plugins>
  </build>

  <dependencies>
    <dependency>
      <artifactId>zeebe-build-tools</artifactId>
      <groupId>io.zeebe</groupId>
      <scope>test</scope>
      <version>${zeebe.version}</version>
    </dependency>
    <dependency>
      <artifactId>atomix-primitive</artifactId>
      <groupId>io.zeebe</groupId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <artifactId>simpleclient</artifactId>
      <groupId>io.prometheus</groupId>
      <version>${prometheus.client.version}</version>
    </dependency>
  </dependencies>
  <modelVersion>4.0.0</modelVersion>
  <name>Atomix Protocols :: Raft</name>

  <packaging>bundle</packaging>

  <parent>
    <artifactId>atomix-protocols-parent</artifactId>
    <groupId>io.zeebe</groupId>
    <version>3.2.0-alpha9</version>
  </parent>

  <profiles>
    <profile>
      <build>
        <plugins>
          <plugin>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <configuration>
              <effort>Max</effort>
              <excludeFilterFile>${spotbugs.exclude}</excludeFilterFile>
              <includeFilterFile>${spotbugs.include}</includeFilterFile>
              <threshold>Low</threshold>
              <xmlOutput>true</xmlOutput>
            </configuration>
            <dependencies>
              <dependency>
                <artifactId>zeebe-build-tools</artifactId>
                <groupId>io.zeebe</groupId>
                <version>${zeebe.version}</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
            <groupId>com.github.spotbugs</groupId>

            <!-- dependency on build tool to reference the spotbugs filter-->
            <version>${plugin.version.spotbugs}</version>
          </plugin>
        </plugins>
      </build>
      <id>spotbugs</id>
    </profile>
  </profiles>


  <properties>

    <checkstyle.config.location>.checkstyle.xml</checkstyle.config.location>
    <plugin.version.checkstyle>3.1.0</plugin.version.checkstyle>
    <plugin.version.compiler>3.8.1</plugin.version.compiler>

    <plugin.version.fmt>2.9</plugin.version.fmt>

    <plugin.version.spotbugs>3.1.12.2</plugin.version.spotbugs>
    <spotbugs.exclude>spotbugs/spotbugs-exclude.xml</spotbugs.exclude>
    <spotbugs.include>spotbugs/spotbugs-include.xml</spotbugs.include>
    <zeebe.version>0.21.1</zeebe.version>
  </properties>

</project>
