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

  <groupId>net.mailific</groupId>
  <artifactId>mailific-serverlib</artifactId>
  <version>1.0.3</version>

  <name>Mailific SMTP Server Library</name>
  <description>Library for receiving email in Java</description>
  <url>https://mailific.net</url>
  <inceptionYear>2021</inceptionYear>

  <scm>
    <connection>scm:git:git://github.com:salesforce/mailific.git</connection>
    <developerConnection>scm:git:ssh://github.com:salesforce/mailific.git</developerConnection>
    <url>https://github.com/salesforce/mailific/tree/main</url>
  </scm>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <name>Central Repository OSSRH</name>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
  </distributionManagement>

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

  <developers>
    <developer>
      <name>Joe Humphreys</name>
      <email>jhumphreys@salesforce.com</email>
      <organizationUrl>http://www.salesforce.com</organizationUrl>
    </developer>
  </developers>

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

    <!-- Dependency Versions -->

    <!-- https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin -->
    <spotless.version>2.28.0</spotless.version>

    <!-- https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin -->
    <jacoco.version>0.8.8</jacoco.version>

    <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
    <netty-version>4.1.85.Final</netty-version>

    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <junit-version>4.13.2</junit-version>

    <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->
    <hamcrest-version>2.2</hamcrest-version>

    <!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
    <mockito-version>4.9.0</mockito-version>

    <!--  -->
    <kr.motd.maven.version>1.7.1</kr.motd.maven.version>
  </properties>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
          <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>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.4.1</version>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-source</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>${netty-version}</version>
    </dependency>

  <!--  TEST DEPENDENCIES -->

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

  <build>
    <plugins>

      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.version}</version>
        <configuration>
          <java>
            <googleJavaFormat>
              <version>1.15.0</version>
              <style>GOOGLE</style>
              <reflowLongStrings>true</reflowLongStrings>
            </googleJavaFormat>
            <licenseHeader>
              <file>${project.basedir}/license-header</file>
            </licenseHeader>
          </java>
       </configuration>
        <executions>
          <execution>
            <id>spotless-apply</id>
            <phase>validate</phase>
            <goals>
              <goal>apply</goal>
            </goals>
          </execution>
        </executions>

      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
