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

  <parent>
    <groupId>io.vertx</groupId>
    <artifactId>vertx5-parent</artifactId>
    <version>15</version>
  </parent>

  <artifactId>vertx-hazelcast-parent</artifactId>
  <version>5.1.6</version>
  <packaging>pom</packaging>

  <name>Vert.x Hazelcast parent</name>

  <scm>
    <connection>scm:git:git@github.com:vert-x3/vertx-hazelcast.git</connection>
    <developerConnection>scm:git:git@github.com:vert-x3/vertx-hazelcast.git</developerConnection>
    <url>git@github.com:vert-x3/vertx-hazelcast.git</url>
  </scm>

  <properties>
    <hazelcast.version>5.6.0</hazelcast.version>
    <vertx.surefire.opensModule>ALL-UNNAMED</vertx.surefire.opensModule>
    <vertx.surefire.useModulePath>false</vertx.surefire.useModulePath>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.27.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.5.19</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <modules>
    <module>vertx-hazelcast</module>
    <module>vertx-hazelcast-it</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
            <systemPropertyVariables>
              <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
              <buildDirectory>${project.build.directory}</buildDirectory>
              <vertxVersion>${project.version}</vertxVersion>
              <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
              <vertx.logger-delegate-factory-class-name>io.vertx.core.logging.SLF4JLogDelegateFactory</vertx.logger-delegate-factory-class-name>
              <hazelcast.logging.type>slf4j</hazelcast.logging.type>
              <hazelcast.tracking.server>true</hazelcast.tracking.server>
            </systemPropertyVariables>
            <!-- Needs to be small enough to run in a EC2 1.7GB small instance -->
            <argLine>-Xmx1200M --add-modules java.se
              --add-exports java.base/jdk.internal.ref=${vertx.surefire.opensModule}
              --add-opens java.base/java.lang=${vertx.surefire.opensModule}
              --add-opens java.base/java.nio=${vertx.surefire.opensModule}
              --add-opens java.base/sun.nio.ch=${vertx.surefire.opensModule}
              --add-opens java.management/sun.management=${vertx.surefire.opensModule}
              --add-opens jdk.management/com.sun.management.internal=${vertx.surefire.opensModule}
            </argLine>
            <forkCount>1</forkCount>
            <reuseForks>true</reuseForks>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
            <systemPropertyVariables>
              <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
              <buildDirectory>${project.build.directory}</buildDirectory>
              <vertxVersion>${project.version}</vertxVersion>
              <vertx.logger-delegate-factory-class-name>io.vertx.core.logging.SLF4JLogDelegateFactory</vertx.logger-delegate-factory-class-name>
              <hazelcast.logging.type>slf4j</hazelcast.logging.type>
            </systemPropertyVariables>
            <!-- Needs to be small enough to run in a EC2 1.7GB small instance -->
            <argLine>-Xmx1200M --add-modules java.se
              --add-exports java.base/jdk.internal.ref=${vertx.surefire.opensModule}
              --add-opens java.base/java.lang=${vertx.surefire.opensModule}
              --add-opens java.base/java.nio=${vertx.surefire.opensModule}
              --add-opens java.base/sun.nio.ch=${vertx.surefire.opensModule}
              --add-opens java.management/sun.management=${vertx.surefire.opensModule}
              --add-opens jdk.management/com.sun.management.internal=${vertx.surefire.opensModule}
              -Djava.net.preferIPv4Stack=true
            </argLine>
            <forkCount>1</forkCount>
            <reuseForks>true</reuseForks>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <!-- Java 11 => use Maven Toolchain to compile this module with JDK 17
       The config file .m2/toolchains.xml is needed with this content

       <toolchains>
         <toolchain>
           <type>jdk</type>
           <provides>
             <id>Java17</id>
             <version>17</version>
           </provides>
           <configuration>
             <jdkHome>/PATH/TO/JDK/17</jdkHome>
           </configuration>
         </toolchain>
       </toolchains>
  -->
  <profiles>
    <profile>
      <id>Java11</id>
      <activation>
        <jdk>[11,17)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-toolchains-plugin</artifactId>
            <version>1.0</version>
            <executions>
              <execution>
                <phase>validate</phase>
                <goals>
                  <goal>toolchain</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <toolchains>
                <jdk>
                  <version>17</version>
                </jdk>
              </toolchains>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
