<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.neo4j.driver</groupId>
  <artifactId>neo4j-java-driver-parent</artifactId>
  <version>4.4.18</version>

  <packaging>pom</packaging>
  <name>Neo4j Java Driver Project</name>
  <description>A project for building a Java driver for the Neo4j Bolt protocol.</description>
  <url>https://github.com/neo4j/neo4j-java-driver</url>

  <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>2</parallelizable.it.forkCount>
    <!-- All tests tagged are to be executed in parallel -->
    <parallelizable.it.tags>parallelizableIT</parallelizable.it.tags>
    <surefire.and.failsafe.version>3.0.0-M6</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.4</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.111.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>2023.0.7</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.11.0</mockito-core.version>
    <junit.version>5.9.3</junit.version>
    <testng-engine.version>1.0.5</testng-engine.version>
    <jarchivelib.version>1.2.0</jarchivelib.version>
    <bouncycastle-jdk18on.version>1.78.1</bouncycastle-jdk18on.version>
    <logback-classic.version>1.2.13</logback-classic.version>
    <jackson.version>2.17.1</jackson.version>
    <lombok.version>1.18.32</lombok.version>
    <svm.version>21.3.10</svm.version>
    <micrometer.version>1.13.1</micrometer.version>
    <testcontainers.version>1.19.8</testcontainers.version>
    <build-resources.version>4.4.34</build-resources.version>
    <!-- To be overwritten by child projects -->
    <moduleName/>
  </properties>

  <modules>
    <module>driver</module>
    <module>bundle</module>
    <module>examples</module>
    <module>testkit-backend</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>
      <id>neo4j</id>
      <name>The Neo4j Team</name>
      <url>http://www.neo4j.com/</url>
      <organization>Neo4j Sweden AB</organization>
      <organizationUrl>http://www.neo4j.com/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/neo4j/neo4j-java-driver.git</connection>
    <developerConnection>scm:git:git@github.com:neo4j/neo4j-java-driver.git</developerConnection>
    <url>https://github.com/neo4j/neo4j-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.junit.support</groupId>
        <artifactId>testng-engine</artifactId>
        <version>${testng-engine.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-jdk18on</artifactId>
        <version>${bouncycastle-jdk18on.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk18on</artifactId>
        <version>${bouncycastle-jdk18on.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>
      <dependency>
        <groupId>org.reactivestreams</groupId>
        <artifactId>reactive-streams-tck</artifactId>
        <version>${reactive-streams.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>testcontainers-bom</artifactId>
        <version>${testcontainers.version}</version>
        <type>pom</type>
        <scope>import</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>
    <!-- If a revision has not been explicitly set, sort it out by looking at git metadata -->
    <profile>
      <id>determine-revision</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <property>
          <name>!build.revision</name>
        </property>
      </activation>
      <properties>
        <build.revision>${git.commit.id.abbrev}</build.revision>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <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-source-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Bundle-Name>${project.name} (Source)</Bundle-Name>
                    <Bundle-SymbolicName>${bundle.name}.source</Bundle-SymbolicName>
                    <Bundle-Version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${build.timestamp}</Bundle-Version>
                    <Eclipse-SourceBundle>${bundle.name};version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${build.timestamp}";roots:="."</Eclipse-SourceBundle>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
          </executions>
        </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>
          <configuration>
            <instructions>
              <Bundle-SymbolicName>${bundle.name}</Bundle-SymbolicName>
              <Bundle-Version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${build.timestamp}</Bundle-Version>
              <_snapshot>${maven.build.timestamp}</_snapshot>
              <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
              <_removeheaders>Bnd-*,Private-Package</_removeheaders>
              <_nouses>true</_nouses>
              <_include>-osgi.bnd</_include>
            </instructions>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.2.0</version>
        </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.neo4j.build.plugins</groupId>
          <artifactId>licensing-maven-plugin</artifactId>
          <version>1.7.11</version>
          <configuration>
            <failIfDisliked>true</failIfDisliked>
            <failIfMissing>true</failIfMissing>
            <plainTextReport>true</plainTextReport>
            <prependText>${rootDir}/build/notice-asl-prefix.txt</prependText>
            <excludedGroups>
              ^((org.neo4j.driver){1})$
            </excludedGroups>
            <includedScopes>compile</includedScopes>
          </configuration>
          <executions>
            <execution>
              <id>list-all-licenses</id>
              <phase>compile</phase>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <licensingRequirementFiles>
                  <licensingRequirementFile>licensing/licensing-requirements-base.xml</licensingRequirementFile>
                </licensingRequirementFiles>
                <thirdPartyLicensingFilename>${project.artifactId}-${project.version}-NOTICE.txt
                </thirdPartyLicensingFilename>
                <checkExistingNoticeFile>${project.build.directory}/../NOTICE.txt</checkExistingNoticeFile>
                <listPrependText>licensing/list-prefix.txt</listPrependText>
                <listReport>${project.artifactId}-${project.version}-LICENSES.txt</listReport>
                <checkExistingLicensesFile>${project.build.directory}/../LICENSES.txt</checkExistingLicensesFile>
              </configuration>
            </execution>
          </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.neo4j.build.plugins</groupId>
        <artifactId>licensing-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-source-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.0.1</version>
        <configuration>
          <charset>UTF-8</charset>
          <docencoding>UTF-8</docencoding>
          <encoding>UTF-8</encoding>
          <top><![CDATA[
            <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/default.min.css">
            <script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
            <script>hljs.initHighlightingOnLoad();</script>
          ]]></top>
          <bottom>
            <![CDATA[
                    <script>
                    if (typeof useModuleDirectories !== 'undefined') {
                      useModuleDirectories = false;
                    }
                    </script>
                ]]>
          </bottom>
          <!-- Required for Java 8u121 or later. See https://github.com/neo4j/neo4j-java-driver/pull/318  -->
          <additionalOptions>--allow-script-in-comments</additionalOptions>
          <sourceFileIncludes>
            <sourceFileInclude>org/neo4j/driver/**/*.java</sourceFileInclude>
          </sourceFileIncludes>
          <excludePackageNames>org.neo4j.driver.internal</excludePackageNames>
          <overview>${rootDir}/build/javadoc/overview.html</overview>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
          <execution>
            <id>aggregate</id>
            <goals>
              <goal>aggregate</goal>
            </goals>
            <phase>site</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire.and.failsafe.version}</version>
        <configuration>
          <argLine>${surefire.and.failsafe.argLine}</argLine>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </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>
              <argLine>-Dfile.encoding=${project.build.sourceEncoding} -DtestJvmId=${surefire.forkNumber}</argLine>
              <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>
      <!-- Explicit deployment override for this artifact only. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <inherited>false</inherited>
        <configuration>
          <skip>false</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>
