<?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.darksci</groupId>
    <artifactId>pardot-api-client</artifactId>
    <version>0.1.0</version>
    <packaging>jar</packaging>

    <!-- Require Maven 3.3.9 -->
    <prerequisites>
        <maven>3.3.9</maven>
    </prerequisites>

    <!-- Module Description and Ownership -->
    <name>Pardot API Client</name>
    <description>A fluent client for Pardot's API</description>
    <url>https://github.com/Crim/pardot-java-client</url>
    <developers>
        <developer>
            <name>Stephen Powis</name>
            <email>stephen.powis@gmail.com</email>
            <organization>Darksci</organization>
            <organizationUrl>https://www.darksci.com/</organizationUrl>
        </developer>
    </developers>

    <!-- MIT License -->
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <!-- Source Control -->
    <scm>
        <connection>scm:git:git://github.com/crim/pardot-java-client.git</connection>
        <developerConnection>scm:git:ssh://github.com:Crim/pardot-java-client.git</developerConnection>
        <url>https://github.com/Crim/pardot-java-client/tree/master</url>
    </scm>

    <!-- Module Properties -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Jackson version -->
        <jackson.version>2.9.0</jackson.version>

        <!-- Define which version of junit you'll be running -->
        <junit.version>4.12</junit.version>

        <!-- Specify which Checkstyle ruleset to use -->
        <checkstyle.ruleset>build/pardot_style-v1.5.xml</checkstyle.ruleset>
        <checkstyle.plugin.version>2.17</checkstyle.plugin.version>
        <checkstyle.version>8.0</checkstyle.version>

        <!-- Log4J Version -->
        <log4j2.version>2.1</log4j2.version>

        <!-- test toggling -->
        <skipTests>false</skipTests>
        <skipCodeCoverage>true</skipCodeCoverage>
        <skipCheckStyle>false</skipCheckStyle>

        <!-- By default exclude Integration/End-to-End tests -->
        <excludeTests>categories.IntegrationTest</excludeTests>
    </properties>

    <!-- Project Dependencies -->
    <dependencies>
        <!-- Http Client -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
        </dependency>

        <!-- For parsing XML responses to POJOs -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j2.version}</version>
        </dependency>

        <!-- Testing Tools -->
        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Data providers on tests -->
        <dependency>
            <groupId>com.tngtech.java</groupId>
            <artifactId>junit-dataprovider</artifactId>
            <version>1.12.0</version>
            <scope>test</scope>
        </dependency>

        <!-- For mocking -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>

        <!-- Used in tests for reading files -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Set Source & Target JRE Version -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <!-- Generates test results -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.19</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>-Xmx256M</argLine>
                    <skipTests>${skipTests}</skipTests>
                    <runOrder>alphabetical</runOrder>

                    <!-- By default exclude Integration Tests -->
                    <excludedGroups>
                        ${excludeTests}
                    </excludedGroups>
                </configuration>
            </plugin>

            <!-- Enforce check styles validation -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <executions>
                    <execution>
                        <id>checkstyle-validate</id>
                        <phase>validate</phase><!-- when we need to run checkstyle::check -->
                        <configuration>
                            <configLocation>${checkstyle.ruleset}</configLocation>
                            <encoding>utf-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <violationSeverity>warning</violationSeverity>
                            <failsOnError>true</failsOnError>
                            <enableRSS>false</enableRSS>

                            <!-- By default we run checkstyle validation-->
                            <skip>${skipCheckStyle}</skip>
                        </configuration>
                        <goals>
                            <!-- Generate site/html report -->
                            <goal>checkstyle</goal>

                            <!-- Enforce failing build on checkstyle failure -->
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Release plugin -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.7</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!-- Use a current version of checkstyle -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${checkstyle.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <!-- Generate Checkstyle html results during reporting phase -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.plugin.version}</version>
                <configuration>
                    <configLocation>${checkstyle.ruleset}</configLocation>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <!-- For deploying to maven central -->
    <distributionManagement>
        <!-- Snapshot repository -->
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <!-- release profile for deploying -->
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Build Sources Jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Build Javadoc Jar -->
                    <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>

                    <!-- GPG Signing of Artifacts -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>114AC1F2</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>