<?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>org.restheart</groupId>
    <artifactId>restheart-parent</artifactId>
    <version>6.2.2</version>
    <packaging>pom</packaging>

    <name>restheart</name>
    <description>RESTHeart - The REST API microservice for MongoDB.</description>
    <url>http://www.restheart.org</url>
    <inceptionYear>2014</inceptionYear>

    <properties>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.source>17</maven.compiler.source>
        <checkstyle.file.path>checkstyle-checker.xml</checkstyle.file.path>
        <dependency.locations.enabled>false</dependency.locations.enabled>
        <!--
            mvn install -DskipUTs   : Skips Unit tests
            mvn install -DskipITs   : Skips Integration tests
            mvn install -DskipTests : Skips both Unit and Integration Tests
        -->
        <skipTests>false</skipTests>
        <skipITs>${skipTests}</skipITs>
        <skipUTs>${skipTests}</skipUTs>
        <!--
            MongoDB default version to test with
            mvn clean verify -Dmongodb.version="5.0"   : Test with mongo:5.0 container
        -->
        <mongodb.version>5.0</mongodb.version>
        <graalvm.version>22.0.0.2</graalvm.version>
        <!--
            mvn compile -DskipUpdateLicense=false add missing license headers
            Ref: https://www.mojohaus.org/license-maven-plugin/usage.html
        -->
        <skipUpdateLicense>true</skipUpdateLicense>
        <!-- SonarCloud configuration -->
        <sonar.projectKey>SoftInstigate_restheart</sonar.projectKey>
        <sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
        <sonar.organization>softinstigate</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    </properties>

    <modules>
        <module>commons</module>
        <module>polyglot</module>
        <module>graphql</module>
        <module>core</module>
        <module>security</module>
        <module>mongodb</module>
        <module>test-plugins</module>
    </modules>

    <!-- Project Information -->
    <organization>
        <name>SoftInstigate</name>
        <url>https://softinstigate.com</url>
    </organization>

    <licenses>
        <license>
            <name>GNU Affero General Public License (AGPL) version 3.0</name>
            <url>http://www.gnu.org/licenses/agpl-3.0.html</url>
            <distribution>repo</distribution>
            <comments>Core components license</comments>
        </license>
        <license>
            <name>Apache License version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
        <license>
            <name>RESTHeart COMMERCIAL LICENSE</name>
            <url>https://github.com/SoftInstigate/restheart/blob/master/COMM-LICENSE.txt</url>
            <distribution>manual</distribution>
            <comments>Optional commercial license</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>ujibang</id>
            <name>Andrea</name>
            <email>andrea@softinstigate.com</email>
            <url>https://www.linkedin.com/in/adicesare</url>
            <organization>SoftInstigate</organization>
            <organizationUrl>http://www.softinstigate.com</organizationUrl>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
            <timezone>+1</timezone>
            <properties>
                <picUrl>https://pbs.twimg.com/profile_images/491316822101479424/dfngbj7q.jpeg</picUrl>
            </properties>
        </developer>
        <developer>
            <id>mkj6</id>
            <name>Maurizio</name>
            <email>maurizio@softinstigate.com</email>
            <url>http://www.maurizioturatti.com</url>
            <organization>SoftInstigate</organization>
            <organizationUrl>http://www.softinstigate.com</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>+1</timezone>
            <properties>
                <picUrl>https://pbs.twimg.com/profile_images/510140480999272448/Ht9Rn6gz.jpeg</picUrl>
            </properties>
        </developer>
    </developers>

    <issueManagement>
        <url>https://github.com/SoftInstigate/restheart/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <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>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <scm>
        <url>https://github.com/SoftInstigate/restheart</url>
        <connection>scm:git:git@github.com:SoftInstigate/restheart.git</connection>
        <developerConnection>scm:git:git@github.com:SoftInstigate/restheart.git</developerConnection>
    </scm>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart-commons</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart-security</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart-mongodb</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart-polyglot</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.restheart</groupId>
                <artifactId>restheart-graphql</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- IMPORTANT
                 upgrading mongodb driver version requires upgrading jnr-unixsocket, mongodb-crypt and snappy-java
                 dependecies in core/pom.xml native-image profile to match versions defined in https://github.com/mongodb/mongo-java-driver/blob/master/build.gradle
                 this is needed to for native-image build to work -->
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-sync</artifactId>
                <version>4.4.1</version>
            </dependency>
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-reactivestreams</artifactId>
                <version>4.4.1</version>
            </dependency>
            <dependency>
                <groupId>io.undertow</groupId>
                <artifactId>undertow-core</artifactId>
                <version>2.2.14.Final</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>31.0.1-jre</version>
            </dependency>
            <dependency>
                <groupId>com.github.ben-manes.caffeine</groupId>
                <artifactId>caffeine</artifactId>
                <version>3.0.5</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.8.9</version>
            </dependency>
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <version>2.6.0</version>
            </dependency>
            <dependency>
                <groupId>de.svenkubiak</groupId>
                <artifactId>jBCrypt</artifactId>
                <version>0.4.3</version>
            </dependency>
            <dependency>
                <groupId>com.auth0</groupId>
                <artifactId>java-jwt</artifactId>
                <version>3.18.1</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.15</version>
            </dependency>
            <dependency>
                <groupId>commons-jxpath</groupId>
                <artifactId>commons-jxpath</artifactId>
                <version>1.3</version>
            </dependency>
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>1.30</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>1.2.10</version>
            </dependency>
            <dependency>
                <groupId>org.kohsuke</groupId>
                <artifactId>akuma</artifactId>
                <version>1.10</version>
            </dependency>
            <dependency>
                <groupId>net.java.dev.jna</groupId>
                <artifactId>jna</artifactId>
                <version>5.10.0</version>
            </dependency>
            <dependency>
                <groupId>org.fusesource.jansi</groupId>
                <artifactId>jansi</artifactId>
                <version>2.4.0</version>
            </dependency>
            <dependency>
                <groupId>com.github.everit-org.json-schema</groupId>
                <artifactId>org.everit.json.schema</artifactId>
                <version>1.14.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tika</groupId>
                <artifactId>tika-core</artifactId>
                <version>2.2.1</version>
            </dependency>
            <dependency>
                <groupId>io.dropwizard.metrics</groupId>
                <artifactId>metrics-core</artifactId>
                <version>4.2.7</version>
            </dependency>
            <dependency>
                <groupId>info.picocli</groupId>
                <artifactId>picocli</artifactId>
                <version>4.6.2</version>
            </dependency>
            <dependency>
                <groupId>com.github.spullara.mustache.java</groupId>
                <artifactId>compiler</artifactId>
                <version>0.9.10</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>io.github.classgraph</groupId>
                <artifactId>classgraph</artifactId>
                <version>4.8.138</version>
            </dependency>
            <dependency>
                <groupId>org.graalvm.sdk</groupId>
                <artifactId>graal-sdk</artifactId>
                <version>${graalvm.version}</version>
                <scope>provided</scope>
            </dependency>
            <!-- https://mvnrepository.com/artifact/com.oracle.substratevm/svm -->
            <dependency>
                <groupId>com.oracle.substratevm</groupId>
                <artifactId>svm</artifactId>
                <version>19.2.1</version>
                <scope>provided</scope>
                <!-- remove transitive dependencies
                     that break karate tests execution
                     we just need the package com.oracle.svm.core.annotate -->
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.graphql-java</groupId>
                <artifactId>graphql-java</artifactId>
                <version>16.2</version>
            </dependency>
            <!-- BEGIN Test dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.intuit.karate</groupId>
                <artifactId>karate-junit4</artifactId>
                <version>1.1.0</version>
                <scope>test</scope>
            </dependency>
            <!-- upgrade karate dependencies on org.graalvm.js artifacts
                 to match the used GraalVM version
                 otherwise the tests execution will hang
            -->
            <dependency>
                <groupId>org.graalvm.js</groupId>
                <artifactId>js-scriptengine</artifactId>
                <version>${graalvm.version}</version>
            </dependency>
            <dependency>
                <groupId>org.graalvm.js</groupId>
                <artifactId>js</artifactId>
                <version>${graalvm.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>4.3.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>fluent-hc</artifactId>
                <version>4.5.13</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.eclipsesource.minimal-json</groupId>
                <artifactId>minimal-json</artifactId>
                <version>0.9.5</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.mashape.unirest</groupId>
                <artifactId>unirest-java</artifactId>
                <version>1.4.9</version>
                <scope>test</scope>
            </dependency>
            <!-- END Test dependencies -->
        </dependencies>
    </dependencyManagement>

    <build>
        <finalName>${finalName}</finalName>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M3</version>
                    <executions>
                        <execution>
                            <id>enforce-versions</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>3.6</version>
                                    </requireMavenVersion>
                                    <requireReleaseDeps>
                                        <message>No Snapshots Allowed!</message>
                                        <onlyWhenRelease>false</onlyWhenRelease>
                                        <failWhenParentIsSnapshot>false</failWhenParentIsSnapshot>
                                        <excludes>
                                            <exclude>org.restheart:*</exclude>
                                        </excludes>
                                    </requireReleaseDeps>
                                    <requireJavaVersion>
                                        <version>16</version>
                                    </requireJavaVersion>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <debug>true</debug>
                        <compilerArgument>-Xlint:unchecked</compilerArgument>
                        <showDeprecation>true</showDeprecation>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M4</version>
                    <configuration>
                        <skipTests>${skipUTs}</skipTests>
                        <excludes>
                            <exclude>**/IT*.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.0.0-M4</version>
                    <configuration>
                        <skipTests>${skipTests}</skipTests>
                        <skipITs>${skipITs}</skipITs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</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-site-plugin</artifactId>
                    <version>3.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>com.github.github</groupId>
                    <artifactId>site-maven-plugin</artifactId>
                    <version>0.12</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>3.0.0-M4</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>3.0.5</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>3.13.0</version>
                </plugin>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.33.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>SoftInstigate</keyname>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <configuration>
                            <doclint>none</doclint>
                            <failOnError>false</failOnError>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>report</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-site-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>com.github.github</groupId>
                        <artifactId>site-maven-plugin</artifactId>
                        <configuration>
                            <server>github</server>
                            <message>Creating site for ${project.version}</message>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>site</goal>
                                </goals>
                                <phase>site</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>com.puppycrawl.tools</groupId>
                                <artifactId>checkstyle</artifactId>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <configLocation>${checkstyle.file.path}</configLocation>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-report-plugin</artifactId>
                        <reportSets>
                            <reportSet>
                                <id>integration-tests</id>
                                <reports>
                                    <report>failsafe-report-only</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>versions-maven-plugin</artifactId>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>dependency-updates-report</report>
                                    <report>plugin-updates-report</report>
                                    <report>property-updates-report</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <configuration>
                            <configLocation>${checkstyle.file.path}</configLocation>
                        </configuration>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>checkstyle</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
    </profiles>
</project>
