<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.evernym.verity</groupId>
  <artifactId>verity-sdk</artifactId>
  <version>0.6.1</version>

  <name>Verity SDK</name>
  <description>The official Java SDK for Evernym's Verity</description>
  <url>https://github.com/evernym/verity-sdk</url>

  <packaging>jar</packaging>

  <organization>
    <name>Evernym, Inc.</name>
    <url>https://www.evernym.com/products/</url>
  </organization>

  <developers>
    <developer>
      <id>dfisher</id>
      <name>Devin Fisher</name>
      <email>devin.fisher@evernym.com</email>
    </developer>
    <developer>
      <id>dkulic</id>
      <name>Darko Kulic</name>
      <email>darko.kulic@evernym.com</email>
    </developer>
  </developers>

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

  <scm>
    <connection>scm:git:git://github.com/evernym/verity-sdk.git</connection>
    <developerConnection>scm:git:ssh://github.com:evernym/verity-sdk.git</developerConnection>
    <url>https://github.com/evernym/verity-sdk</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <profiles>
    <profile>
      <id>release</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <gpg.skip>false</gpg.skip>
        <gpg.passphrase>${env.OSSHR_GPG_PASSPHRASE}</gpg.passphrase>
        <gpg.keyname>${env.OSSRH_GPG_SIGNING_KEY_NAME}</gpg.keyname>
        <repository.id>ossrh</repository.id>
        <repository.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</repository.url>
      </properties>
      <build>
        <plugins>
          <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>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <gpgArguments> <!-- Not totally sure why this is needed but it stops gpg from launching prompt for passphrase -->
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <repositories>
    <repository>
      <id>gitlab-maven</id>
      <url>${env.CI_SERVER_URL}/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.evernym.vdrtools</groupId>
      <artifactId>vdr-tools</artifactId>
      <version>0.8.4</version>
    </dependency>
    <dependency>
      <groupId>org.bitcoinj</groupId>
      <artifactId>bitcoinj-core</artifactId>
      <version>0.15.10</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.5.13</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.30</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.7.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>3.11.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <!-- different goals use these configuration different, we need both -->
          <destDir>${project.basedir}/doc/_build</destDir>
          <reportOutputDirectory>${project.basedir}/doc/_build</reportOutputDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <parallel>all</parallel>
          <useUnlimitedThreads>true</useUnlimitedThreads>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.14.0</version>
        <configuration>
          <failOnViolation>true</failOnViolation> <!-- this is actually true by default, but can be disabled -->
          <printFailingErrors>true</printFailingErrors>
          <excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <destDir>${project.basedir}/doc/_build</destDir>
          <reportOutputDirectory>${project.basedir}/doc/_build</reportOutputDirectory>
        </configuration>
      </plugin>
      <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</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
  <!--
    <repository>
      <id>${repository.id}</id>
      <url>${repository.url}</url>
    </repository>
  -->
    <repository>
      <id>gitlab-maven</id>
      <url>${env.CI_SERVER_URL}/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
    </repository>
    <snapshotRepository>
      <id>gitlab-maven</id>
      <url>${env.CI_SERVER_URL}/api/v4/projects/${env.CI_PROJECT_ID}/packages/maven</url>
    </snapshotRepository>
  </distributionManagement>
</project>
