<?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.fully-automated</groupId>
    <artifactId>full-automation</artifactId>
    <version>1.0</version>

    <!-- Properties(Variables) section -->
    <properties>
        <!-- Packaging properties -->
        <jar.name>full-automation</jar.name>
        <jar.description>An automation framework for Web/Mobile and APIs powered by Ismail Isleem</jar.description>
        <framework.repo.url>https://bitbucket.org/ismailahd/full-automation</framework.repo.url>

        <!-- Distribution management properties -->
        <dist.repo.id>ossrh</dist.repo.id>
        <dist.snapshot.name>Sonatype Nexus Snapshots</dist.snapshot.name>
        <dist.stage.name>Nexus Release Repository</dist.stage.name>
        <dist.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots/</dist.snapshot.url>
        <dist.stage.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</dist.stage.url>

        <!-- License properties -->
        <license.name>The Apache License, Version 2.0</license.name>
        <license.url>http://www.apache.org/licenses/LICENSE-2.0.txt</license.url>

        <!-- Developer info properties -->
        <dev.name>Ismail Isleem</dev.name>
        <dev.email>iisleem@fully-automated.com</dev.email>
        <dev.org>Fully-Automated</dev.org>
        <dev.org.url>https://www.fully-automated.com/</dev.org.url>

        <!-- CSM repo management properties -->
        <connection>scm:git:git://bitbucket.org/ismailahd/full-automation.git</connection>
        <dev.connection>scm:git:ssh://bitbucket.org:ismailahd/full-automation.git</dev.connection>
        <connection.url>https://bitbucket.org/ismailahd/full-automation</connection.url>

        <!-- Dependencies versions -->
        <testng.version>6.13.1</testng.version>
        <selenium.version>3.8.1</selenium.version>
        <driver-manager.version>2.0.1</driver-manager.version>
        <extent-report.version>2.41.2</extent-report.version>
        <commons-validator.version>1.6</commons-validator.version>
        <commons-io.version>2.6</commons-io.version>
        <apache-tika.version>1.17</apache-tika.version>
        <appium.version>5.0.4</appium.version>
        <sshd-core.version>1.7.0</sshd-core.version>

        <!-- Plugins versions -->
        <java-level.version>1.8</java-level.version>
        <maven-level.version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</maven-level.version>
        <maven-level.msg>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.
        </maven-level.msg>
    </properties>

    <!-- Output to jar format -->
    <packaging>jar</packaging>
    <name>${jar.name}</name>
    <description>${jar.description}</description>
    <url>${framework.repo.url}</url>

    <!-- Distribution management for publishing our repo -->
    <distributionManagement>
        <snapshotRepository>
            <id>${dist.repo.id}</id>
            <name>${dist.snapshot.name}</name>
            <url>${dist.snapshot.url}</url>
        </snapshotRepository>
        <repository>
            <id>${dist.repo.id}</id>
            <name>${dist.stage.name}</name>
            <url>${dist.stage.url}</url>
        </repository>
    </distributionManagement>

    <!-- Licence Information -->
    <licenses>
        <license>
            <name>${license.name}</name>
            <url>${license.url}</url>
        </license>
    </licenses>

    <!-- Developer Information -->
    <developers>
        <developer>
            <name>${dev.name}</name>
            <email>${dev.email}</email>
            <organization>${dev.org}</organization>
            <organizationUrl>${dev.org.url}</organizationUrl>
        </developer>
    </developers>

    <!-- BitBucket hosted information -->
    <scm>
        <connection>${connection}</connection>
        <developerConnection>${dev.connection}</developerConnection>
        <url>${connection.url}</url>
    </scm>

    <!-- Maven Build Plugins -->
    <build>
        <plugins>
            <!-- Enforcer plugin provides goals to control certain environmental constraints -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>${maven-level.version}</version>
                                    <message>${maven-level.msg}</message>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!-- Plugin to release framework jars to prepare and deploy them to mvn repo-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <useReleaseProfile>false</useReleaseProfile>
                        <arguments>-Prelease</arguments>
                    </configuration>
                </plugin>
                <!-- Plugin to enforce project Java compilation level 1.8 and above -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${java-level.version}</source>
                        <target>${java-level.version}</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!-- Profiles section to run mvn command for a specific profile to apply specific settings -->
    <profiles>
        <!-- Release profile to apply deployment settings on oss.sonatype.org site -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- This plugin to generate framework sources to push them to mvn repo -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- This plugin to generate framework javadocs to push them to mvn repo -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- This plugin to verify and sign all framework jars before push them to mvn repo -->
                    <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>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- Maven Dependencies -->
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>

        <!-- 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/io.github.bonigarcia/webdrivermanager -->
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>${driver-manager.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
        <dependency>
            <groupId>com.relevantcodes</groupId>
            <artifactId>extentreports</artifactId>
            <version>${extent-report.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>${commons-validator.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-core -->
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>${apache-tika.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>${appium.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.sshd/sshd-core -->
        <dependency>
            <groupId>org.apache.sshd</groupId>
            <artifactId>sshd-core</artifactId>
            <version>${sshd-core.version}</version>
        </dependency>
    </dependencies>

</project>
