<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.coveros</groupId>
    <artifactId>selenified</artifactId>
    <version>3.0.2</version>

    <prerequisites>
        <maven>3.0.4</maven>
    </prerequisites>

    <properties>
        <!-- General Java properties -->
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Test run information -->
        <failsafe.threads>5</failsafe.threads>
        <failsafe.verbosity>0</failsafe.verbosity>
        <failsafe.groups.include>integration</failsafe.groups.include>
        <failsafe.groups.exclude>browser</failsafe.groups.exclude>
        <failsafe.files.include>**/*IT.java</failsafe.files.include>
        <failsafe.files.exclude></failsafe.files.exclude>

        <skip.unit.tests>false</skip.unit.tests>
        <skip.integration.tests>false</skip.integration.tests>

        <!-- General Selenium run versions -->
        <selenium.version>3.12.0</selenium.version>
        <webdrivermanager.version>2.2.1</webdrivermanager.version>
        <phantomjsdriver.version>2.0.0</phantomjsdriver.version>
        <slf4j.version>1.7.25</slf4j.version>
        <testng.version>6.14.3</testng.version>

        <!-- Additional plugin versions -->
        <maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
        <maven.failsafe.plugin.version>2.21.0</maven.failsafe.plugin.version>
        <maven.gpg.plugin.version>1.5</maven.gpg.plugin.version>
        <maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version>
        <maven.source.plugin.version>2.2.1</maven.source.plugin.version>
        <maven.surefire.plugin.version>2.21.0</maven.surefire.plugin.version>
        <clirr.maven.plugin.version>2.8</clirr.maven.plugin.version>
        <dependency.check.maven.version>3.0.2</dependency.check.maven.version>
        <jacoco.maven.plugin.version>0.7.9</jacoco.maven.plugin.version>
        <lint.maven.plugin.version>0.0.11</lint.maven.plugin.version>
        <nexus.staging.maven.plugin.version>1.6.7</nexus.staging.maven.plugin.version>

        <!-- SonarQube properties -->
        <sonar.host.url>http://localhost:9000/sonar</sonar.host.url>
        <sonar.sources>src/main/java</sonar.sources>
        <sonar.test>src/test/java</sonar.test>
        <sonar.junit.reportPaths>target/surefire-reports,target/failsafe-reports</sonar.junit.reportPaths>
        <sonar.jacoco.reportPaths>target/coverage-reports/jacoco-ut.exec,target/coverage-reports/jacoco-it.exec</sonar.jacoco.reportPaths>
    </properties>

    <name>Selenified Testing Framework</name>
    <description>Selenified provides traceable reporting for both web and API testing, wraps and extends Selenium calls
        to more appropriately handle testing errors, and supports testing over multiple browsers locally, or in the
        cloud (Selenium Grid or SauceLabs) in parallel.
    </description>
    <url>https://github.com/Coveros/selenified</url>

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

    <developers>
        <developer>
            <name>Max Saperstone</name>
            <email>max.saperstone@coveros.com</email>
            <organization>Coveros, Inc.</organization>
            <organizationUrl>http://coveros.com</organizationUrl>
        </developer>
        <developer>
            <name>Matt Grasberger</name>
            <email>matt.grasberger@coveros.com</email>
            <organization>Coveros, Inc.</organization>
            <organizationUrl>http://coveros.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/Coveros/selenified.git</connection>
        <developerConnection>scm:git:ssh://github.com:Coveros/selenified.git</developerConnection>
        <url>https://github.com/Coveros/selenified/tree/master</url>
    </scm>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>${webdrivermanager.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.github.jesg/phantomjsdriver -->
        <dependency>
            <groupId>com.github.jesg</groupId>
            <artifactId>phantomjsdriver</artifactId>
            <version>${phantomjsdriver.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
    </dependencies>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <!-- Sets the VM argument line used when unit tests are run. -->
                    <argLine>${surefireArgLine}</argLine>
                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->
                    <skipTests>${skip.unit.tests}</skipTests>
                    <!-- Excludes integration tests when unit tests are run. -->
                    <excludes>
                        <exclude>**/*IT.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/docs</outputDirectory>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven.source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.failsafe.plugin.version}</version>
                <configuration>
                    <parallel>methods</parallel>
                    <threadCount>${failsafe.threads}</threadCount>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <value>${failsafe.verbosity}</value>
                        </property>
                        <property>
                            <name>listener</name>
                            <value>com.coveros.selenified.utilities.Transformer</value>
                        </property>
                    </properties>
                    <groups>${failsafe.groups.include}</groups>
                    <excludedGroups>${failsafe.groups.exclude}</excludedGroups>
                    <includes>
                        <include>${failsafe.files.include}</include>
                    </includes>
                    <excludes>
                        <exclude>${failsafe.files.exclude}</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the VM argument line used when integration tests are run. -->
                            <argLine>${failsafeArgLine}</argLine>
                            <!-- Skips integration tests if the value of skip.integration.tests
                                property is true -->
                            <skipTests>${skip.integration.tests}</skipTests>
                        </configuration>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the VM argument line used when integration tests are run. -->
                            <argLine>${failsafeArgLine}</argLine>
                            <!-- Skips integration tests if the value of skip.integration.tests
                                property is true -->
                            <skipTests>${skip.integration.tests}</skipTests>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.maven.plugin.version}</version>
                <executions>
                    <!-- Prepares the property pointing to the JaCoCo runtime agent which
                        is passed as VM argument when Maven the Surefire plugin is executed. -->
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                            <!-- Sets the name of the property containing the settings for JaCoCo
                                runtime agent. -->
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <!-- Ensures that the code coverage report for unit tests is created
                        after unit tests have been run. -->
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- The Executions required by unit tests are omitted. -->
                    <!-- Prepares the property pointing to the JaCoCo runtime agent which
                        is passed as VM argument when Maven the Failsafe plugin is executed. -->
                    <execution>
                        <id>pre-integration-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                            <!-- Sets the name of the property containing the settings for JaCoCo
                                runtime agent. -->
                            <propertyName>failsafeArgLine</propertyName>
                        </configuration>
                    </execution>
                    <!-- Ensures that the code coverage report for integration tests after
                        integration tests have been run. -->
                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven.gpg.plugin.version}</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>
                <version>${nexus.staging.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <!-- Set this to true and the release will automatically proceed and
                        sync to Central Repository will follow -->
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <version>${dependency.check.maven.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.lewisd</groupId>
                    <artifactId>lint-maven-plugin</artifactId>
                    <version>${lint.maven.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>${dependency.check.maven.version}</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>clirr-maven-plugin</artifactId>
                <version>${clirr.maven.plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>
</project>
