<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.goldmansachs.accelrx</groupId>
    <artifactId>api-parent</artifactId>
    <version>1.0.0-beta.7</version>
    <packaging>pom</packaging>

    <name>accel.rx contract API</name>
    <description>API for accel.rx, a toolset for building API driven reactive microservices</description>
    <url>https://github.com/goldmansachs/accelrx/</url>
    <inceptionYear>2023</inceptionYear>

    <organization>
        <name>Goldman Sachs</name>
        <url>http://www.goldmansachs.com/</url>
    </organization>

    <developers>
        <developer>
            <name>Mat Robinson</name>
            <email>mathew.robinson@gs.com</email>
            <organization>Goldman Sachs</organization>
        </developer>
        <developer>
            <id>jmoghisi</id>
            <name>Javad Moghisi</name>
            <email>javad.moghisi@gs.com</email>
            <organization>Goldman Sachs</organization>
        </developer>
        <developer>
            <name>Thomas Burnell</name>
            <email>thomas.burnell@gs.com</email>
            <organization>Goldman Sachs</organization>
        </developer>
    </developers>

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

    <scm>
        <connection>scm:git:https://github.com/goldmansachs/accelrx-contract-api.git</connection>
        <developerConnection>scm:git:https://github.com/goldmansachs/accelrx-contract-api.git</developerConnection>
        <url>https://github.com/goldmansachs/accelrx-contract-api/tree/main</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/goldmansachs/accelrx/issues</url>
    </issueManagement>

    <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>
        <!-- prod snapshot not needed as nexus-staging-maven-plugin handles that -->
    </distributionManagement>

    <modules>
        <module>contract</module>
        <module>web-contract-api</module>
    </modules>

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

        <rxjava.version>3.1.5</rxjava.version>
        <vertx.version>4.3.4</vertx.version>
        <guava.version>31.1-jre</guava.version>
        <jackson.databind.version>2.13.4.2</jackson.databind.version>

        <!-- testing dependencies -->
        <junit.version>5.8.2</junit.version>
        <assertj.version>3.22.0</assertj.version>

        <!-- maven plugin versions -->
        <clean.plugin.version>3.1.0</clean.plugin.version>
        <compiler.plugin.version>3.10.1</compiler.plugin.version>
        <enforcer.plugin.version>3.1.0</enforcer.plugin.version>
        <source.plugin.version>3.2.1</source.plugin.version>
        <resources.plugin.version>3.2.0</resources.plugin.version>
        <gpg.plugin.version>3.0.1</gpg.plugin.version>
        <jar.plugin.version>3.2.2</jar.plugin.version>
        <javadoc.plugin.version>3.4.1</javadoc.plugin.version>
        <nexus.staging.plugin.version>1.6.13</nexus.staging.plugin.version>
        <surefire.plugin.version>3.0.0-M5</surefire.plugin.version>
        <surefire.tree-reporter.version>1.1.0</surefire.tree-reporter.version>
        <jacoco.plugin.version>0.8.7</jacoco.plugin.version>
        <deploy.plugin.version>2.8</deploy.plugin.version>
        <install.plugin.version>3.0.0-M1</install.plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.reactivex.rxjava3</groupId>
                <artifactId>rxjava</artifactId>
                <version>${rxjava.version}</version>
            </dependency>

            <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.databind.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <dependencies>
        <!-- Testing -->
        <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-engine</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.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${clean.plugin.version}</version>
            </plugin>

            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>${source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${enforcer.plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <banDuplicatePomDependencyVersions/>
                                <requireUpperBoundDeps/>
                                <!--                                    <dependencyConvergence/> plugin too hard to fix !!-->
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${resources.plugin.version}</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${compiler.plugin.version}</version>
                <configuration>
                    <compilerArgument>-parameters</compilerArgument>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>me.fabriciorby</groupId>
                        <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
                        <version>${surefire.tree-reporter.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>
                        @{argLine} -Dfile.encoding=UTF-8 -Duser.country=${user.country} -Duser.language=${user.language}
                    </argLine>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <statelessTestsetReporter
                            implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
                        <disable>false</disable>
                        <usePhrasedFileName>true</usePhrasedFileName>
                        <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
                        <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
                        <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
                    </statelessTestsetReporter>

                    <consoleOutputReporter>
                        <disable>true</disable>
                    </consoleOutputReporter>
                    <statelessTestsetInfoReporter
                            implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
                        <disable>false</disable>
                        <usePhrasedFileName>true</usePhrasedFileName>
                        <usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
                        <usePhrasedClassNameInTestCaseSummary>true</usePhrasedClassNameInTestCaseSummary>
                    </statelessTestsetInfoReporter>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${jar.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Build-Date>${maven.build.timestamp}</Build-Date>
                            <Build-Number>${CI_JOB_ID}</Build-Number>
                            <Pipeline-Url>${CI_PIPELINE_URL}</Pipeline-Url>
                            <Commit-Revision>${CI_COMMIT_SHA}</Commit-Revision>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
                <configuration>
                    <excludes>
                        <exclude>META-INF/**</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>coverage-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                                <rule>
                                    <element>CLASS</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0%</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0%</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>${install.plugin.version}</version>
            </plugin>

            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${deploy.plugin.version}</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ci</id>
            <activation>
                <property>
                    <name>env.CI</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus.staging.plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                    <!-- Prevent gpg from using pinentry programs.
                                         Fixes: gpg: signing failed: Inappropriate ioctl for device -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

</project>
