<?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>com.microsoft.playwright</groupId>
  <artifactId>parent-pom</artifactId>
  <version>1.53.0</version>
  <packaging>pom</packaging>
  <name>Playwright Parent Project</name>
  <description>Java library to automate Chromium, Firefox and WebKit with a single API.
    Playwright is built to enable cross-browser web automation that is ever-green, capable,
    reliable and fast.

    This is the parent POM of the project.
  </description>
  <url>https://github.com/microsoft/playwright-java</url>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <organization>Microsoft</organization>
      <organizationUrl>http://www.microsoft.com/</organizationUrl>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:https://github.com/microsoft/playwright-java.git</connection>
    <developerConnection>scm:git:https://github.com/microsoft/playwright-java.git</developerConnection>
    <url>https://github.com/microsoft/playwright-java</url>
  </scm>

  <modules>
    <module>driver</module>
    <module>driver-bundle</module>
    <module>playwright</module>
  </modules>
  <properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <gson.version>2.12.1</gson.version>
    <junit.version>5.12.1</junit.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <websocket.version>1.6.0</websocket.version>
    <slf4j.version>2.0.17</slf4j.version>
    <opentest4j.version>1.3.0</opentest4j.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.microsoft.playwright</groupId>
        <artifactId>driver</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>com.microsoft.playwright</groupId>
        <artifactId>driver-bundle</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${gson.version}</version>
      </dependency>
      <dependency>
        <groupId>org.opentest4j</groupId>
        <artifactId>opentest4j</artifactId>
        <version>${opentest4j.version}</version>
      </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.java-websocket</groupId>
        <artifactId>Java-WebSocket</artifactId>
        <version>${websocket.version}</version>
        <scope>test</scope>
      </dependency>
      <!-- 
        The following slf4j-simple dependency resolves the warning:
        'SLF4J(W): No SLF4J providers were found.'
        This warning is produced by the org.java-websocket library.
      -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>${slf4j.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.version}</version>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.11.2</version>
          <configuration>
            <additionalOptions>--allow-script-in-comments</additionalOptions>
            <failOnError>false</failOnError>
            <!-- passing 8 causes an assertion in javadoc tool, see https://github.com/microsoft/playwright-java/issues/1533 -->
            <source>11</source>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.3</version>
          <configuration>
            <properties>
              <configurationParameters>
                junit.jupiter.execution.parallel.enabled = true
                junit.jupiter.execution.parallel.mode.default = same_thread
                junit.jupiter.execution.parallel.mode.classes.default = concurrent
                junit.jupiter.execution.parallel.config.strategy=dynamic
                junit.jupiter.execution.parallel.config.dynamic.factor=0.5
              </configurationParameters>
            </properties>
            <failIfNoTests>false</failIfNoTests>
            <rerunFailingTestsCount>${env.PW_MAX_RETRIES}</rerunFailingTestsCount>
            <!-- Activate the use of TCP to transmit events to the plugin and avoid
            [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM -->
            <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.2</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <!-- Prevent `gpg` from using pinentry programs -->
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
