<!--
  Copyright 2021 IBM Corp. All Rights Reserved.

  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>com.ibm.utils</groupId>
  <artifactId>kv-utils</artifactId>
  <version>0.5.0</version>
  <name>kv-utils</name>
  <description>Abstracted helper classes providing consistent key-value store functionality, with zookeeper and etcd3 implementations.</description>
  <url>https://github.com/IBM/kv-utils</url>

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

  <developers>
    <developer>
      <id>njhill</id>
      <name>Nick Hill</name>
      <email>nickhill@us.ibm.com</email>
      <organization>IBM</organization>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:IBM/kv-utils.git</connection>
    <developerConnection>scm:git:git@github.com:IBM/kv-utils.git</developerConnection>
    <url>https://github.com/IBM/kv-utils</url>
  </scm>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <!-- By default, the Surefire Plugin will automatically include all test
          classes with the following wildcard patterns: "**/Test*.java" - includes
          all of its subdirectories and all Java filenames that start with "Test".
          "**/*Test.java" - includes all of its subdirectories and all Java filenames
          that end with "Test". "**/*TestCase.java" - includes all of its subdirectories
          and all Java filenames that end with "TestCase". If the test classes do not
          follow any of these naming conventions, then configure Surefire Plugin and
          specify the tests you want to include. -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <includes>
            <include>**/*Tests.java</include>
            <include>**/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <doclint>none</doclint>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Nexus Staging Plugin -->
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.8</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>false</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
    <snapshotRepository>
        <id>ossrh</id>
        <name>Central Repository OSSRH</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <dependencies>

    <!-- This is required for compiling on java11+, to provide
         the @Generated annotation used in the protoc-generated
         gRPC stubs. "provided" scope is sufficient since this
         annotation only has source retention. -->
    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-annotations-api</artifactId>
      <version>9.0.50</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.31</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>30.1.1-jre</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
      <version>3.5.9</version>
      <scope>compile</scope>
      <optional>true</optional> <!-- optional for etcd-only usage -->
      <exclusions>
        <!-- these deps are actually optional -->
        <exclusion>
          <groupId>jline</groupId>
          <artifactId>jline</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-annotations</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- also brings in required curator-framework and curator-client -->
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-recipes</artifactId>
      <version>5.1.0</version>
      <scope>compile</scope>
      <optional>true</optional> <!-- optional for etcd-only usage -->
      <exclusions>
        <!--  use our own zk dependency -->
        <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- etcd -->

    <dependency>
      <groupId>com.ibm.etcd</groupId>
      <artifactId>etcd-java</artifactId>
      <version>0.0.18</version>
      <scope>compile</scope>
      <optional>true</optional> <!-- optional for zookeeper-only usage -->
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.12.4</version>
      <scope>compile</scope>
    </dependency>

    <!-- test scope dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-test</artifactId>
      <version>5.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.31</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <profiles>
    <profile>
       <id>deploy</id>
       <activation>
          <activeByDefault>false</activeByDefault>
       </activation>
       <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-source-plugin</artifactId>
              <version>3.2.1</version>
              <executions>
                <execution>
                  <id>attach-sources</id>
                  <goals>
                    <goal>jar-no-fork</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                   <execution>
                      <id>sign-artifacts</id>
                      <phase>verify</phase>
                      <goals>
                         <goal>sign</goal>
                      </goals>
                      <configuration>
                        <!-- Prevent `gpg` from using pinentry programs -->
                        <gpgArguments>
                            <arg>--pinentry-mode</arg>
                            <arg>loopback</arg>
                        </gpgArguments>
                    </configuration>
                   </execution>
                </executions>
             </plugin>
          </plugins>
       </build>
    </profile>
  </profiles>
</project>
