<?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.kquiet</groupId>
  <artifactId>auto-browser</artifactId>
  <version>2.0.7</version>
  <packaging>jar</packaging>
  <name>${project.groupId}:${project.artifactId}</name>
  <description>A java library wrapping selenium to help focus on browser automation.</description>
  <url>https://github.com/kquiet/auto-browser</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>17</maven.compiler.release>
    
    <selenium.version>4.20.0</selenium.version>
    <slf4j.version>2.0.13</slf4j.version>
    
    <junit.version>5.10.2</junit.version>
    <takes.version>1.24.4</takes.version>
    <logback.version>1.5.6</logback.version>
    
    <test.webdriver.directory.chrome.windows>${project.basedir}\third_party\webdriver\chromedriver\110.0.5481.77\win32</test.webdriver.directory.chrome.windows>
    <test.webdriver.directory.chrome.linux>${project.basedir}/third_party/webdriver/chromedriver/110.0.5481.77/linux64</test.webdriver.directory.chrome.linux>
    <test.webdriver.directory.firefox.windows>${project.basedir}\third_party\webdriver\geckodriver\0.32.2\win64</test.webdriver.directory.firefox.windows>
    <test.webdriver.directory.firefox.linux>${project.basedir}/third_party/webdriver/geckodriver/0.32.2/linux64</test.webdriver.directory.firefox.linux>
  </properties>
  
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-api</artifactId>
      <version>${selenium.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-remote-driver</artifactId>
      <version>${selenium.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-support</artifactId>
      <version>${selenium.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-firefox-driver</artifactId>
      <version>${selenium.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-chrome-driver</artifactId>
      <version>${selenium.version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.takes</groupId>
      <artifactId>takes</artifactId>
      <version>${takes.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <directory>${project.basedir}/target</directory>
    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
    <outputDirectory>${project.build.directory}/classes</outputDirectory>
    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
    <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
      <testResource>
        <directory>${project.basedir}/src/test/java</directory>
        <includes>
          <include>**/*.html</include>
        </includes>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
        <configuration>
          <compilerArgs>
            <arg>-Xlint:deprecation,unchecked</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.6.3</version>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.3</version>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.1.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.3.2</version>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.5</version>
      </plugin>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>4.0.0-M13</version>
      </plugin>
      <plugin>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.5.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.2.4</version>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.8.4.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.4.1</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Automatic-Module-Name>${project.groupId}.autobrowser</Automatic-Module-Name>
              <Build-Time>${maven.build.timestamp}</Build-Time>
              <Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
              <Implementation-SCM-Branch>${scmBranch}</Implementation-SCM-Branch>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.13</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh-kquiet</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>false</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.1</version>
        <extensions>true</extensions>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
          <scmCommentPrefix>[release]</scmCommentPrefix>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
          <testSourceDirectories>${project.build.testSourceDirectory}</testSourceDirectories>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <violationSeverity>warning</violationSeverity>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals><goal>create</goal></goals>
          </execution>
        </executions>
        <configuration>
          <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.8.4.0</version>
        <configuration>
          <!--
            Enables analysis which takes more memory but finds more bugs.
            If you run out of memory, changes the value of the effort element
            to 'Low'.
            -->
          <effort>Max</effort>
          <!-- Build doesn't fail if problems are found -->
          <failOnError>false</failOnError>
          <!-- Reports all bugs (available values are Low, Medium and Max) -->
          <threshold>Low</threshold>
          <!-- Produces XML report -->
          <xmlOutput>true</xmlOutput>
          <!-- Configures the directory in which the XML report is created -->
          <spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs</spotbugsXmlOutputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>setup-test-webdriver-windows</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.2.5</version>
            <configuration>
              <systemPropertyVariables>
                <test.browser>firefox</test.browser>
                <webdriver.chrome.driver>${test.webdriver.directory.chrome.windows}${file.separator}chromedriver.exe</webdriver.chrome.driver>
                <webdriver.gecko.driver>${test.webdriver.directory.firefox.windows}${file.separator}geckodriver.exe</webdriver.gecko.driver>
                <webdriver_headless>yes</webdriver_headless>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>setup-test-webdriver-linux</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.2.5</version>
            <configuration>
              <systemPropertyVariables>
                <test.browser>firefox</test.browser>
                <webdriver.chrome.driver>${test.webdriver.directory.chrome.linux}${file.separator}chromedriver</webdriver.chrome.driver>
                <webdriver.gecko.driver>${test.webdriver.directory.firefox.linux}${file.separator}geckodriver</webdriver.gecko.driver>
                <webdriver_headless>yes</webdriver_headless>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.3.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.6.3</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <release>8</release>
                  <doclint>none</doclint>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh-kquiet</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh-kquiet</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
  </distributionManagement>

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

  <developers>
    <developer>
      <name>Kimberly</name>
      <email>mrkid863@gmail.com</email>
      <organization>none</organization>
      <organizationUrl>https://github.com/kquiet</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/kquiet/auto-browser.git</connection>
    <developerConnection>scm:git:https://github.com/kquiet/auto-browser.git</developerConnection>
    <url>https://github.com/kquiet/auto-browser/tree/main</url>
    <tag>auto-browser-2.0.7</tag>
  </scm>
</project>
