<?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.terheyden</groupId>
    <artifactId>value-stack</artifactId>
    <name>value-stack</name>
    <version>0.0.1</version> <!-- here -->
    <description>Java Value Stack monad for Functional Programming</description>
    <url>http://github.com/terheyden/value-stack</url>

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

    <developers>
        <developer>
            <name>Luke Terheyden</name>
            <email>terheyden@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/terheyden/value-stack.git</connection>
        <developerConnection>scm:git:ssh://github.com:terheyden/value-stack.git</developerConnection>
        <url>http://github.com/terheyden/value-stack/tree/main</url>
    </scm>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit-jupiter.version>5.9.1</junit-jupiter.version> <!-- org/junit/jupiter/junit-jupiter-api -->
        <mockito.version>4.8.0</mockito.version> <!-- org/mockito/mockito-core -->
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/io.vavr/vavr -->
        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr</artifactId>
            <version>0.10.4</version> <!-- io/vavr/vavr -->
        </dependency>
        <!-- @ParametersAreNonnullByDefault, @Nonnull, @Nullable -->
        <!-- https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-annotations -->
        <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-annotations</artifactId>
            <version>4.7.2</version> <!-- com/github/spotbugs/spotbugs-annotations -->
        </dependency>
        <!-- SLF4J via Logback -->
        <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.4.1</version> <!-- ch/qos/logback/logback-classic -->
        </dependency>

        <!-- Test dependencies -->

        <!-- JUnit 5 -->
        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- JUnit 5 engine for running tests during maven build -->
        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Mockito mocks -->
        <!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>

        <!-- keep Maven from injecting values into our keystore -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <plugins>
            <!-- Enforce Maven up to version 3.x -->
            <!-- Required for maven-version-plugin -->
            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.1.0</version> <!-- org/apache/maven/plugins/maven-enforcer-plugin -->
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <!-- Make sure there are no dependency duplicates -->
                                <banDuplicatePomDependencyVersions />
                                <!-- Require deps to converge to the same version -->
                                <dependencyConvergence>
                                    <!-- Converge snapshotted versions also by comparing jar timestamps -->
                                    <uniqueVersions>true</uniqueVersions>
                                </dependencyConvergence>
                                <!-- Enforce Java version -->
                                <requireJavaVersion>
                                    <version>17</version>
                                </requireJavaVersion>
                                <!-- Required for maven-version-plugin -->
                                <requireMavenVersion>
                                    <version>3.0.4</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html -->
            <!-- https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html -->
            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version> <!-- org/apache/maven/plugins/maven-surefire-plugin -->
                <configuration>
                    <!-- Groups / Categories / Tags to exclude -->
                    <excludedGroups>integration</excludedGroups>
                    <!-- Run multiple classes in parallel -->
                    <parallel>classes</parallel>
                    <!-- One thread per core -->
                    <perCoreThreadCount>true</perCoreThreadCount>
                    <threadCount>1</threadCount>
                </configuration>
            </plugin>
            <!-- When we're built, don't include our logback.xml -->
            <!-- https://maven.apache.org/plugins/maven-jar-plugin/ -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/logback.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>

        <!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
        <pluginManagement>
            <plugins>
                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.2.0</version> <!-- org/apache/maven/plugins/maven-clean-plugin -->
                </plugin>
                <!-- default lifecycle, jar packaging:
                     see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.0</version> <!-- org/apache/maven/plugins/maven-resources-plugin -->
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.10.1</version> <!-- org/apache/maven/plugins/maven-compiler-plugin -->
                </plugin>
                <!-- Required for running unit tests from the cmd line -->
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version> <!-- org/apache/maven/plugins/maven-surefire-plugin -->
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.3.0</version> <!-- org/apache/maven/plugins/maven-jar-plugin -->
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.1</version> <!-- org/apache/maven/plugins/maven-install-plugin -->
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-deploy-plugin -->
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0</version> <!-- org/apache/maven/plugins/maven-deploy-plugin -->
                </plugin>
                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-site-plugin -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version> <!-- org/apache/maven/plugins/maven-site-plugin -->
                </plugin>
                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-project-info-reports-plugin -->
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.4.1</version> <!-- org/apache/maven/plugins/maven-project-info-reports-plugin -->
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <!-- Use: -P release to upload to Maven Central with sources and javadocs -->
            <id>release</id>
            <build>
                <plugins>
                    <!-- Uploads our JARs to Maven Central staging area -->
                    <!-- https://central.sonatype.org/publish/publish-maven/ -->
                    <!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version> <!-- org/sonatype/plugins/nexus-staging-maven-plugin -->
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <!-- Signs our artifacts for release -->
                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version> <!-- org/apache/maven/plugins/maven-gpg-plugin -->
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Attach source code to our JAR -->
                    <!-- https://maven.apache.org/plugins/maven-source-plugin/usage.html -->
                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version> <!-- org/apache/maven/plugins/maven-source-plugin -->
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Attach JavaDocs -->
                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version> <!-- org/apache/maven/plugins/maven-javadoc-plugin -->
                        <configuration>
                            <!-- https://stackoverflow.com/questions/39616344/how-to-disable-javadoc-warnings-in-maven-javadoc-plugin -->
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                            <additionalJOption>-Xdoclint:none</additionalJOption>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

            <!-- Where we upload our releases -->
            <!-- https://central.sonatype.org/publish/publish-maven/ -->
            <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>

        </profile>
    </profiles>

</project>
