<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/POM/4.0.0"
  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.computablefacts</groupId>
  <artifactId>junon</artifactId>
  <version>0.11</version>
  <packaging>jar</packaging>

  <name>junon</name>
  <description>Junon.</description>
  <url>https://github.com/computablefacts/junon</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:computablefacts/junon.git</connection>
    <developerConnection>scm:git:git@github.com:computablefacts/junon.git</developerConnection>
    <url>https://github.com/computablefacts/junon.git</url>
    <tag>HEAD</tag>
  </scm>

  <developers>
    <developer>
      <name>ComputableFacts</name>
      <email>engineering@computablefacts.com</email>
      <url>https://computablefacts.com</url>
    </developer>
  </developers>

  <properties>
    <guava.version>31.1-jre</guava.version>
    <jackson.version>2.14.0</jackson.version>
    <error-prone.version>2.15.0</error-prone.version>
    <junit.version>4.13.1</junit.version>
    <equalsverifier.version>3.11</equalsverifier.version>
    <maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven-source-plugin.version>2.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>2.9.1</maven-javadoc-plugin.version>
    <maven-nexus-staging-plugin.version>1.6.8</maven-nexus-staging-plugin.version>
    <maven-jacoco-plugin.version>0.8.8</maven-jacoco-plugin.version>
    <maven-surefire-plugin.version>3.0.0-M3</maven-surefire-plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.errorprone</groupId>
      <artifactId>error_prone_annotations</artifactId>
      <version>${error-prone.version}</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>nl.jqno.equalsverifier</groupId>
      <artifactId>equalsverifier</artifactId>
      <version>${equalsverifier.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>${basedir}/src</sourceDirectory>
    <testSourceDirectory>${basedir}/test</testSourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}/src/resources</directory>
      </resource>
    </resources>
    <plugins>

      <!-- Restrict Imports -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M2</version>
        <dependencies>
          <dependency>
            <groupId>de.skuzzle.enforcer</groupId>
            <artifactId>restrict-imports-enforcer-rule</artifactId>
            <version>1.1.0</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>check-logging-imports</id>
            <phase>process-sources</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Junon must not inherit from Nona</reason>
                  <bannedImport>com.computablefacts.nona.**</bannedImport>
                </restrictImports>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Junon must not inherit from Decima</reason>
                  <bannedImport>com.computablefacts.decima.**</bannedImport>
                </restrictImports>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Junon must not inherit from Morta</reason>
                  <bannedImport>com.computablefacts.morta.**</bannedImport>
                </restrictImports>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Junon must not inherit from Jupiter</reason>
                  <bannedImport>com.computablefacts.jupiter.**</bannedImport>
                </restrictImports>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Junon must not inherit from LogFmt</reason>
                  <bannedImport>com.computablefacts.logfmt.**</bannedImport>
                </restrictImports>
                <restrictImports
                  implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
                  <reason>Use SLF4j for logging</reason>
                  <bannedImport>java.util.logging.**</bannedImport>
                </restrictImports>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Compile project using Google Error-Prone -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>8</source>
          <target>8</target>
          <encoding>UTF-8</encoding>
          <compilerArgs>
            <arg>-XDcompilePolicy=simple</arg>
            <arg>-Xplugin:ErrorProne</arg>
          </compilerArgs>
          <annotationProcessorPaths>
            <path>
              <groupId>com.google.errorprone</groupId>
              <artifactId>error_prone_core</artifactId>
              <version>${error-prone.version}</version>
            </path>
            <!-- Other annotation processors go here.

            If 'annotationProcessorPaths' is set, processors will no longer be
            discovered on the regular -classpath; see also 'Using Error Prone
            together with other annotation processors' below. -->
          </annotationProcessorPaths>
        </configuration>
      </plugin>

      <!-- Enable git commit id -->
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <version>${git-commit-id-plugin.version}</version>
        <artifactId>git-commit-id-plugin</artifactId>
        <executions>
          <execution>
            <id>get-the-git-infos</id>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
          <execution>
            <id>validate-the-git-infos</id>
            <goals>
              <goal>validateRevision</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
        <configuration>
          <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
          <prefix>git</prefix>
          <verbose>false</verbose>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
          <generateGitPropertiesFilename>
            ${project.build.outputDirectory}/git.properties
          </generateGitPropertiesFilename>
          <format>json</format>
          <gitDescribe>
            <skip>false</skip>
            <always>false</always>
            <dirty>-dirty</dirty>
          </gitDescribe>
          <!--
          <validationProperties>
              <validationProperty>
                  <name>validating git dirty</name>
                  <value>${git.dirty}</value>
                  <shouldMatchTo>false</shouldMatchTo>
              </validationProperty>
          </validationProperties>
          -->
        </configuration>
      </plugin>

      <!-- Code Coverage Reports -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${maven-jacoco-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Unit Tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <parallel>methods</parallel>
          <threadCount>5</threadCount>
          <skipTests>false</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>allow-snapshots</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>snapshots-repo</id>
          <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
    <profile>
      <id>publish</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <configuration>
              <!-- Prevent gpg from using pinentry programs -->
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${maven-nexus-staging-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>
    </profile>
  </profiles>
</project>
