<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.algorand</groupId>
    <artifactId>algosdk</artifactId>
    <version>1.19.0</version>
    <packaging>jar</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>Client library for Algorand</description>
    <url>https://github.com/algorand/java-algorand-sdk</url>

    <scm>
        <connection>scm:git:git@github.com:algorand/java-algorand-sdk.git</connection>
        <developerConnection>scm:git:git@github.com:algorand/java-algorand-sdk.git</developerConnection>
        <url>https://github.com/algorand/java-algorand-sdk</url>
    </scm>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://github.com/algorand/java-algorand-sdk/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Benjamin Chan</name>
            <email>ben.chan@algorand.com</email>
        </developer>
    </developers>

    <properties>
        <junit5.version>5.6.2</junit5.version>
        <assertj.version>3.17.1</assertj.version>
        <cucumber.version>6.6.0</cucumber.version>
        <mockito.version>3.5.7</mockito.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
        <maven.surefire.version>3.0.0-M5</maven.surefire.version>

        <!-- Test sources at 1.8 to allow using JUnit5 -->
        <java.version>1.7</java.version>
        <java.release.version>7</java.release.version>
        <java.test.release.version>8</java.test.release.version>

        <!-- github server corresponds to entry in ~/.m2/settings.xml -->
        <github.global.server>github</github.global.server>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
          <version>2.10.0</version>
        </dependency>
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
          <version>2.10.0</version>
        </dependency>
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.10.5.1</version>
        </dependency>
        <dependency>
          <groupId>com.google.code.gson</groupId>
          <artifactId>gson</artifactId>
          <version>2.8.1</version>
        </dependency>
        <dependency>
          <groupId>com.squareup.okhttp</groupId>
          <artifactId>logging-interceptor</artifactId>
          <version>2.7.5</version>
        </dependency>
        <dependency>
          <groupId>com.squareup.okhttp</groupId>
          <artifactId>okhttp</artifactId>
          <version>2.7.5</version>
        </dependency>
        <dependency>
          <groupId>com.squareup.okio</groupId>
          <artifactId>okio</artifactId>
          <version>1.6.0</version>
        </dependency>
        <dependency>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
          <!-- version 1.14 adds some stronger constraints to base64 encoding which breaks a test. -->
          <version>1.12</version>
        </dependency>
        <dependency>
          <groupId>io.gsonfire</groupId>
          <artifactId>gson-fire</artifactId>
          <version>1.8.0</version>
        </dependency>
        <dependency>
          <groupId>io.swagger</groupId>
          <artifactId>swagger-annotations</artifactId>
          <version>1.5.18</version>
        </dependency>
        <dependency>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
          <!-- this is the last version with java 1.7 support -->
          <version>3.8</version>
        </dependency>
        <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcprov-jdk15to18</artifactId>
          <version>1.66</version>
        </dependency>
        <dependency>
          <groupId>org.msgpack</groupId>
          <artifactId>jackson-dataformat-msgpack</artifactId>
          <version>0.9.0</version>
        </dependency>
        <dependency>
          <groupId>org.threeten</groupId>
          <artifactId>threetenbp</artifactId>
          <version>1.3.5</version>
        </dependency>
        <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>28.2-android</version>
        </dependency>

        <!-- test dependencies -->

        <!-- assertions library -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- junit 5 -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit5.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- cucumber -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- cucumber dependency injection -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- end test dependencies -->
    </dependencies>

    <build>
      <plugins>
        <!-- Newer version of surefire plugin for running JUnit5 tests. -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.version}</version>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
            <executions>
              <execution>
                <id>unit-tests</id>
                <phase>test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skipTests>false</skipTests>
                  <includes>
                    <include>**/*.*</include>
                  </includes>
                </configuration>
              </execution>
            </executions>
        </plugin>
      </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${maven.compiler.plugin.version}</version>
                        <configuration>
                            <release>${java.release.version}</release>
                            <testRelease>${java.test.release.version}</testRelease>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- IDE Profile: https://youtrack.jetbrains.com/issue/IDEA-85478#focus=streamItem-27-1994481.0-0 -->
        <!-- Note: IntelliJ doesn't support different targets: https://youtrack.jetbrains.com/issue/IDEA-85478 -->
        <!-- Automatically activated when IDEA sets a property, putting this second overrides source/target. -->
        <profile>
            <id>ide</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>idea.maven.embedder.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${maven.compiler.plugin.version}</version>
                        <configuration>
                            <release>${java.test.release.version}</release>
                            <testRelease>${java.test.release.version}</testRelease>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!--
                Maven release profile.
                'mvn clean deploy -P release'

                Update settings.xml with the following server configuration:
                  <settings>
                   <servers>
                     <server>
                       <id>ossrh</id>
                       <username>your-jira-id</username>
                       <password>your-jira-pwd</password>
                     </server>
                   </servers>
                 </settings>
            -->
            <id>release</id>

            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>

            <build>
                <plugins>
                    <!-- staging for OSSRH -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <!-- generate sources jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- generate javadoc jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <configuration>
                          <source>${java.version}</source>
                          <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- gpg signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- This is necessary for gpg to not try to use the pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!--
                Maven github release profile.
                'mvn clean deploy -P github'

                Update settings.xml with the following server configuration:
                  <settings>
                   <servers>
                     <server>
                       <id>github</id>
                       <password>your-github-oauth-token</password>
                     </server>
                   </servers>
                 </settings>
            -->
            <id>github</id>
            <distributionManagement>
                <repository>
                    <id>internal.repo</id>
                    <name>Temporary Staging Repository</name>
                    <url>file://${project.build.directory}/mvn-repo</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>2.8.1</version>
                        <configuration>
                            <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>com.github.github</groupId>
                        <artifactId>site-maven-plugin</artifactId>
                        <version>0.11</version>
                        <configuration>
                            <message>Maven artifacts for ${project.version}</message>  <!-- git commit message -->
                            <noJekyll>true</noJekyll>                                  <!-- disable webpage processing -->
                            <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <!-- matches distribution management repository url above -->
                            <branch>refs/heads/mvn-repo</branch>                       <!-- remote branch name -->
                            <includes><include>**/*</include></includes>
                            <repositoryName>java-algorand-sdk</repositoryName>      <!-- github repo name -->
                            <repositoryOwner>algorand</repositoryOwner>
                        </configuration>
                        <executions>
                            <!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
                            <execution>
                                <goals>
                                    <goal>site</goal>
                                </goals>
                                <phase>deploy</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- publish javadoc to github in site phase -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <configuration>
                          <source>${java.version}</source>
                          <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>gen-javadocs</id>
                                <goals>
                                    <goal>javadoc</goal>
                                </goals>
                                <phase>site</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>3.0.0</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-site-plugin</artifactId>
                        <version>3.7.1</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-scm-publish-plugin</artifactId>
                        <version>3.0.0</version>
                        <configuration>
                            <checkoutDirectory>${project.build.directory}/scmpublish</checkoutDirectory>
                            <checkinComment>Publishing javadoc for ${project.artifactId}:${project.version}</checkinComment>
                            <content>${project.reporting.outputDirectory}/apidocs</content>
                            <skipDeletedFiles>true</skipDeletedFiles>
                            <pubScmUrl>scm:git:git@github.com:algorand/java-algorand-sdk.git</pubScmUrl>
                            <scmBranch>gh-pages</scmBranch> <!-- branch with static site -->
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>publish-scm</goal>
                                </goals>
                                <phase>site</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
