<?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>io.sfrei</groupId>
  <artifactId>tracksearch</artifactId>
  <version>0.8.0</version>

  <packaging>jar</packaging>

  <name>TrackSearch Library</name>
  <description>Library to gain track metadata from different sources</description>
  <url>https://github.com/s-frei/TrackSearch</url>

  <developers>
    <developer>
      <id>s-frei</id>
      <url>https://github.com/s-frei</url>
    </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/s-frei/TrackSearch</url>
    <connection>scm:git:https://github.com/s-frei/TrackSearch.git</connection>
    <developerConnection>scm:git:git@github.com:s-frei/TrackSearch.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

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

    <java-version>11</java-version>

    <!-- deps -->
    <lombok.version>1.18.26</lombok.version>
    <retrofit.version>2.9.0</retrofit.version>
    <okhttp.version>4.10.0</okhttp.version>
    <jackson-databind.version>2.14.2</jackson-databind.version>
    <jsoup.version>1.15.4</jsoup.version>
    <slf4j-api.version>2.0.7</slf4j-api.version>
    <junit.version>5.9.2</junit.version>
    <assertj-core.version>3.24.2</assertj-core.version>
    <logback-classic.version>1.4.6</logback-classic.version>

    <!-- test n report -->
    <maven-surefire.version>3.0.0</maven-surefire.version>
    <maven-surefire-tree-reporter.version>1.1.0</maven-surefire-tree-reporter.version>

    <!-- build n deploy -->
    <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
    <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
    <maven-release-plugin.version>3.0.0</maven-release-plugin.version>
    <maven-scm-provider-gitexe.version>2.0.0</maven-scm-provider-gitexe.version>
    <maven-scm-api.version>2.0.0</maven-scm-api.version>
    <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
    <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
  </properties>

  <profiles>
    <profile>
      <!-- Publish packages to GitHub -->
      <id>github</id>
      <distributionManagement>
        <repository>
          <id>github</id>
          <name>GitHub s-frei Apache Maven Packages</name>
          <url>https://maven.pkg.github.com/s-frei/TrackSearch</url>
        </repository>
      </distributionManagement>
    </profile>
    <profile>
      <!-- Publish packages to Maven Central -->
      <id>maven-central</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>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
              <localCheckout>true</localCheckout>
              <pushChanges>false</pushChanges>
              <mavenExecutorId>forked-path</mavenExecutorId>
              <arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-gitexe</artifactId>
                <version>${maven-scm-provider-gitexe.version}</version>
              </dependency>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-api</artifactId>
                <version>${maven-scm-api.version}</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <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>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>detailed-client-test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>ClientTest</excludedGroups>
              <parallel>all</parallel>
              <forkCount>4</forkCount>
              <useUnlimitedThreads>true</useUnlimitedThreads>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>fancy-report</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>me.fabriciorby</groupId>
                <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
                <version>${maven-surefire-tree-reporter.version}</version>
              </dependency>
            </dependencies>
            <configuration>
              <trimStackTrace>false</trimStackTrace>
              <disableXmlReport>true</disableXmlReport>
              <reportFormat>plain</reportFormat>
              <consoleOutputReporter>
                <disable>true</disable>
              </consoleOutputReporter>
              <statelessTestsetInfoReporter
                implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporterUnicode">
              </statelessTestsetInfoReporter>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.squareup.retrofit2</groupId>
      <artifactId>retrofit</artifactId>
      <version>${retrofit.version}</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>${okhttp.version}</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp-urlconnection</artifactId>
      <version>${okhttp.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson-databind.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>${jsoup.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-api.version}</version>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj-core.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback-classic.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
        <version>${lombok-maven-plugin.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>delombok</goal>
            </goals>
            <configuration>
              <addOutputDirectory>false</addOutputDirectory>
              <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
              <outputDirectory>${project.build.directory}/delombok</outputDirectory>
              <encoding>${project.build.sourceEncoding}</encoding>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${java-version}</source>
          <target>${java-version}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <verbose>true</verbose>
          <doclint>none</doclint>
          <charset>${project.build.sourceEncoding}</charset>
          <encoding>${project.build.sourceEncoding}</encoding>
          <docencoding>${project.build.sourceEncoding}</docencoding>
          <sourcepath>${project.build.directory}/delombok</sourcepath>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludedGroups>DetailedClientTest</excludedGroups>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${nexus-staging-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>
