<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.memgraph</groupId>
    <artifactId>bolt-java-driver-parent</artifactId>
    <version>0.4.7</version>

    <name>Bolt Protocol Java Driver Project</name>
    <description>A project for building a Java driver for Bolt protocol used by graph databases.</description>
    <url>https://github.com/memgraph/bolt-java-driver</url>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.build.timestamp.format>'v'yyyyMMdd-HHmm</maven.build.timestamp.format>

        <bundle.name>${project.groupId}.${project.artifactId}</bundle.name>

        <rootDir>${project.basedir}</rootDir>
        <parallelizable.it.forkCount>1C</parallelizable.it.forkCount>
        <!-- All tests tagged are to be executed in parallel -->
        <parallelizable.it.tags>parallelizableIT</parallelizable.it.tags>
        <surefire.and.failsafe.version>2.22.1</surefire.and.failsafe.version>
        <!-- Skip deployment by default for everything in this project. -->
        <maven.deploy.skip>true</maven.deploy.skip>

        <!-- Versions -->
        <reactive-streams.version>1.0.3</reactive-streams.version>
        <!-- Please note that when updating this dependency -->
        <!-- (i.e. due to a security vulnerability or bug) that the -->
        <!-- corresponding server dependency also needs updating.-->
        <netty-bom.version>4.1.78.Final</netty-bom.version>
        <!-- Please note that when updating this dependency -->
        <!-- (i.e. due to a security vulnerability or bug) that the -->
        <!-- corresponding server dependency also needs updating.-->
        <reactor-bom.version>2020.0.20</reactor-bom.version>
        <rxjava.version>2.2.21</rxjava.version>
        <slf4j-api.version>1.7.36</slf4j-api.version>
        <hamcrest-junit.version>2.0.0.0</hamcrest-junit.version>
        <mockito-core.version>4.6.1</mockito-core.version>
        <junit.version>5.8.2</junit.version>
        <jarchivelib.version>1.2.0</jarchivelib.version>
        <bouncycastle-jdk15on.version>1.70</bouncycastle-jdk15on.version>
        <logback-classic.version>1.2.11</logback-classic.version>
        <jackson.version>2.13.3</jackson.version>
        <lombok.version>1.18.24</lombok.version>
        <svm.version>21.3.2.1</svm.version>
        <micrometer.version>1.9.1</micrometer.version>
        <build-resources.version>4.4.8</build-resources.version>
        <nexus.staging.maven.plugin.version>1.6.7</nexus.staging.maven.plugin.version>
        <!-- To be overwritten by child projects -->
        <moduleName/>
    </properties>

    <modules>
        <module>driver</module>
        <module>bundle</module>
        <!--<module>examples</module>-->
        <!--<module>testkit-ackend</module>-->
        <!--<module>testkit-tests</module>-->
    </modules>

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

    <developers>
        <developer>
            <name>Andi Skrgat</name>
            <email>andi.skrgat@memgraph.io</email>
            <organization>Memgraph</organization>
            <organizationUrl>https://memgraph.com</organizationUrl>
        </developer>

        <developer>
            <name>Josip Mrden</name>
            <email>josip.mrden@memgraph.io</email>
            <organization>Memgraph</organization>
            <organizationUrl>https://memgraph.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/memgraph/bolt-java-driver.git</connection>
        <developerConnection>scm:git:git@github.com:memgraph/bolt-java-driver.git</developerConnection>
        <url>https://github.com/memgraph/bolt-java-driver</url>
    </scm>

    <dependencyManagement>
        <dependencies>
            <!-- Compile dependencies -->
            <dependency>
                <groupId>org.reactivestreams</groupId>
                <artifactId>reactive-streams</artifactId>
                <version>${reactive-streams.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-bom</artifactId>
                <version>${netty-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.projectreactor</groupId>
                <artifactId>reactor-bom</artifactId>
                <version>${reactor-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!--Compile dependencies only used by Examples-->
            <dependency>
                <groupId>io.reactivex.rxjava2</groupId>
                <artifactId>rxjava</artifactId>
                <version>${rxjava.version}</version>
            </dependency>

            <!-- Optional dependencies -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>io.micrometer</groupId>
                <artifactId>micrometer-core</artifactId>
                <version>${micrometer.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- Test dependencies -->
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-junit</artifactId>
                <version>${hamcrest-junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito-core.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.rauschig</groupId>
                <artifactId>jarchivelib</artifactId>
                <version>${jarchivelib.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>${bouncycastle-jdk15on.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>${bouncycastle-jdk15on.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback-classic.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- Testkit Backend Dependencies -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- Graal VM -->
            <dependency>
                <groupId>org.graalvm.nativeimage</groupId>
                <artifactId>svm</artifactId>
                <version>${svm.version}</version>
                <!-- Provided scope as it is only needed for compiling the SVM substitution classes -->
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>java9</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>9</jdk>
            </activation>
            <properties>
                <maven.compiler.source>9</maven.compiler.source>
                <maven.compiler.target>9</maven.compiler.target>
            </properties>
        </profile>

        <!-- Disable parallel execution of integration tests with "-DsequentialITs" -->
        <profile>
            <id>sequentialIntegrationTests</id>
            <activation>
                <property>
                    <name>sequentialITs</name>
                </property>
            </activation>
            <properties>
                <parallelizable.it.forkCount>1</parallelizable.it.forkCount>
            </properties>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>clirr-maven-plugin</artifactId>
                    <version>2.8</version>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>2.2.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>3.5.0</version>
                    <executions>
                        <execution>
                            <id>bundle-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <transformers>
                                    <transformer
                                            implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                </transformers>
                                <filters>
                                    <filter>
                                        <artifact>*:*</artifact>
                                        <excludes>
                                            <exclude>META-INF/*.SF</exclude>
                                            <exclude>META-INF/*.DSA</exclude>
                                            <exclude>META-INF/*.RSA</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.diffplug.spotless</groupId>
                    <artifactId>spotless-maven-plugin</artifactId>
                    <version>2.21.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <java>
                            <palantirJavaFormat/>
                        </java>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0</version>
                    <dependencies>
                        <dependency>
                            <groupId>de.skuzzle.enforcer</groupId>
                            <artifactId>restrict-imports-enforcer-rule</artifactId>
                            <version>2.0.0</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <rules>
                            <RestrictImports>
                                <reason>Star imports are not allowed, please configure your editor to substitute them
                                    with fully qualified imports.
                                </reason>
                                <bannedImport>**.'*'</bannedImport>
                            </RestrictImports>
                        </rules>
                        <fail>true</fail>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>3.0</version>
                    <configuration>
                        <strictCheck>true</strictCheck>
                        <header>${rootDir}/build/license-header.txt</header>
                        <mapping>
                            <java>SLASHSTAR_STYLE</java>
                        </mapping>
                        <includes>
                            <include>**/*.java</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <!-- always check license headers -->
                            <id>check-licenses</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                        <!-- also available: `mvn license:[cmd]` where cmd could be one of `check`, `format`, or `delete`-->
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.neo4j.build</groupId>
                            <artifactId>build-resources</artifactId>
                            <version>${build-resources.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.7</version>
                </plugin>

            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.and.failsafe.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${surefire.and.failsafe.version}</version>
                <executions>
                    <!-- execution 1: execute all ITs that support parallel execution (regular single-instance tests)  -->
                    <execution>
                        <id>parallelizable-integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <forkCount>${parallelizable.it.forkCount}</forkCount>
                            <reuseForks>true</reuseForks>
                            <groups>${parallelizable.it.tags}</groups>
                        </configuration>
                    </execution>

                    <!-- execution 2: execute all ITs that do not support parallel execution (stub server tests, causal cluster tests)  -->
                    <execution>
                        <id>sequential-integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                            <trimStackTrace>false</trimStackTrace>
                            <forkCount>1</forkCount>
                            <reuseForks>true</reuseForks>
                            <excludedGroups>${parallelizable.it.tags}</excludedGroups>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Deployment -->
            <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.4.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.0.1</version>
                <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>
                <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>
</project>
