<?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.github.dannil</groupId>
  <artifactId>scb-java-client</artifactId>
  <version>3.0.0</version>
  <packaging>jar</packaging>

  <name>scb-java-client</name>
  <description>Java client for the SCB (Statistiska centralbyrån) API</description>
  <url>https://github.com/dannil/scb-java-client</url>

  <developers>
    <developer>
      <id>dannil</id>
      <name>Daniel Nilsson</name>
      <email>daniel.nilsson94@outlook.com</email>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>Europe/Stockholm</timezone>
    </developer>
  </developers>

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

  <scm>
    <url>https://github.com/dannil/scb-java-client</url>
    <connection>scm:git:https://github.com/dannil/scb-java-client.git</connection>
    <developerConnection>scm:git:git@github.com:dannil/scb-java-client.git</developerConnection>
    <tag>v3.0.0</tag>
  </scm>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/dannil/scb-java-client/issues</url>
  </issueManagement>
  <ciManagement>
    <system>Travis CI</system>
    <url>https://travis-ci.org/dannil/scb-java-client</url>
  </ciManagement>

  <properties>
    <!-- General configuration -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <project.java.source>11</project.java.source>
    <project.java.target>11</project.java.target>

    <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
  </properties>

  <dependencies>
    <!-- Core dependencies -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.10.3</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.10.3</version>
    </dependency>

    <!-- Core dependencies (logging) -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.8.0-beta4</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-launcher</artifactId>
      <version>1.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>3.3.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>info.debatty</groupId>
      <artifactId>java-string-similarity</artifactId>
      <version>1.2.1</version>
      <scope>test</scope>
    </dependency>

    <!-- Test dependencies (logging) -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j18-impl</artifactId>
      <version>2.13.1</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus snapshot repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Sonatype Nexus release repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <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>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M4</version>
        <configuration>
          <forkCount>3</forkCount>
          <reuseForks>true</reuseForks>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.0.0-M4</version>
        <configuration>
          <systemPropertyVariables>
            <testsDayLimit>7</testsDayLimit>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.5</version>
        <executions>
          <!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as a VM argument when maven-surefire-plugin 
            is executed -->
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data -->
              <destFile>${project.build.directory}/jacoco-unit.exec</destFile>
              <!-- Sets the name of the property containing the settings for JaCoCo runtime agent -->
              <propertyName>argLine</propertyName>
            </configuration>
          </execution>
          <!-- Ensures that the code coverage report for unit tests is created after unit tests have been run -->
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data -->
              <dataFile>${project.build.directory}/jacoco-unit.exec</dataFile>
              <!-- Sets the output directory for the code coverage report -->
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-unit</outputDirectory>
            </configuration>
          </execution>
          <!-- The Executions required by unit tests are omitted. Prepares the property pointing to the JaCoCo runtime agent 
            which is passed as a VM argument when maven-failsafe-plugin is executed. -->
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data -->
              <destFile>${project.build.directory}/jacoco-integration.exec</destFile>
              <!-- Sets the name of the property containing the settings for JaCoCo runtime agent -->
              <propertyName>argLine</propertyName>
            </configuration>
          </execution>
          <!-- Ensures that the code coverage report for integration tests after integration tests have been run -->
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <!-- Sets the path to the file which contains the execution data -->
              <dataFile>${project.build.directory}/jacoco-integration.exec</dataFile>
              <!-- Sets the output directory for the code coverage report -->
              <outputDirectory>${project.reporting.outputDirectory}/jacoco-integration</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>merge</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>merge</goal>
            </goals>
            <configuration>
              <fileSets>
                <fileSet>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>*.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
              <destFile>${project.build.directory}/jacoco.exec</destFile>
            </configuration>
          </execution>
          <execution>
            <id>report</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.siom79.japicmp</groupId>
        <artifactId>japicmp-maven-plugin</artifactId>
        <version>0.14.3</version>
        <configuration>
          <parameter>
            <onlyModified>false</onlyModified>
            <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
            <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
            <overrideCompatibilityChangeParameters>
              <overrideCompatibilityChangeParameter>
                <compatibilityChange>METHOD_ADDED_TO_PUBLIC_CLASS</compatibilityChange>
                <semanticVersionLevel>MINOR</semanticVersionLevel>
              </overrideCompatibilityChangeParameter>
            </overrideCompatibilityChangeParameters>
          </parameter>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>cmp</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.1.1</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.30</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>checkstyle</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <configLocation>src/test/resources/checkstyle/checkstyle.xml</configLocation>
              <suppressionsLocation>src/test/resources/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
              <failOnViolation>true</failOnViolation>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>${project.java.source}</source>
          <target>${project.java.target}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <compilerArgs>
            <arg>-Xlint:all</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.1.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>3.0.0-M1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-consistency</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <dependencyConvergence />
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>enforce-banned-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>true</searchTransitive>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>enforce-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.3.9</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>${project.java.source}</version>
                </requireJavaVersion>
                <requirePluginVersions>
                  <message>All plugins must have a specified version.</message>
                </requirePluginVersions>
                <requireSameVersions>
                  <dependencies>
                    <dependency>com.fasterxml.jackson.core:jackson-core</dependency>
                    <dependency>com.fasterxml.jackson.core:jackson-databind</dependency>
                  </dependencies>
                </requireSameVersions>
                <requireSameVersions>
                  <dependencies>
                    <dependency>org.apache.logging.log4j:*</dependency>
                  </dependencies>
                </requireSameVersions>
                <requireSameVersions>
                  <dependencies>
                    <dependency>org.junit.jupiter:*</dependency>
                  </dependencies>
                </requireSameVersions>
                <requireSameVersions>
                  <dependencies>
                    <dependency>org.junit.platform:*</dependency>
                  </dependencies>
                </requireSameVersions>
                <bannedDependencies>
                  <excludes>
                    <!--Due to changes in the logging system for slf4j versions 2.0.0 and over, which breaks logging in applications 
                      using this library, only versions below this (i.e. 1.8.0) is allowed -->
                    <exclude>org.slf4j:slf4j-api:1.9*</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>enforce-no-snapshots</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireReleaseDeps>
                  <message>No snapshots allowed as release dependencies.</message>
                </requireReleaseDeps>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>enforce-bytecode-version</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <enforceBytecodeVersion>
                  <maxJdkVersion>${project.java.target}</maxJdkVersion>
                </enforceBytecodeVersion>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>enforce-ban-duplicate-classes</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <banDuplicateClasses>
                  <findAllDuplicates>true</findAllDuplicates>
                </banDuplicateClasses>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <!-- Not usable right now, see https://github.com/mojohaus/extra-enforcer-rules/issues/48 -->
          <!-- <execution> -->
          <!-- <id>enforce-utf8-encoding</id> -->
          <!-- <goals> -->
          <!-- <goal>enforce</goal> -->
          <!-- </goals> -->
          <!-- <configuration> -->
          <!-- <rules> -->
          <!-- <requireEncoding> -->
          <!-- <encoding>${project.build.sourceEncoding}</encoding> -->
          <!-- <includes>src/main/resources/**,src/test/resources/**</includes> -->
          <!-- </requireEncoding> -->
          <!-- </rules> -->
          <!-- <failFast>false</failFast> -->
          <!-- <fail>true</fail> -->
          <!-- </configuration> -->
          <!-- </execution> -->
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>extra-enforcer-rules</artifactId>
            <version>1.2</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>3.0.0-M1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <source>${project.java.source}</source>
          <additionalJOptions>
            <additionalJOption>-Xdoclint:all</additionalJOption>
            <additionalJOption>-html5</additionalJOption>
          </additionalJOptions>
          <failOnError>true</failOnError>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.9.0</version>
      </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-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.0.0</version>
        <reportSets>
          <reportSet>
            <reports>
              <!-- The ordering of the elements below effects the menu generated by maven-site-plugin, with the top-most 
                element appearing highest in the menu, the next one below that and so forth -->
              <report>index</report>
              <report>summary</report>
              <report>ci-management</report>
              <report>dependencies</report>
              <report>dependency-info</report>
              <report>distribution-management</report>
              <report>issue-management</report>
              <report>licenses</report>
              <report>plugin-management</report>
              <report>plugins</report>
              <report>scm</report>
              <report>team</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

</project>