<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <name>HERE AAA Client SDK Parent POM</name>
    <groupId>com.here.account</groupId>
    <artifactId>here-aaa-sdk</artifactId>
    <version>0.4.27</version>
    <packaging>pom</packaging>
    <description>here-aaa-sdk is for clients of the HERE AAA, and demos grant_type=client_credentials</description>
    <url>http://github.com/heremaps/here-aaa-java-sdk</url>

    <licenses>
        <license>
          <name>Apache License, Version 2.0</name>
          <url>https://github.com/heremaps/here-aaa-java-sdk/blob/master/LICENSE</url>
          <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
          <name>Riccardo Gulia</name>
          <email>riccardo.gulia@here.com</email>
          <organization>HERE Europe B.V.</organization>
          <organizationUrl>https://github.com/heremaps</organizationUrl>
        </developer>
    </developers>

    <scm>
      <connection>scm:git:https://github.com/heremaps/here-aaa-java-sdk.git</connection>
      <developerConnection>scm:git:git@github.com:heremaps/here-aaa-java-sdk.git</developerConnection>
      <url>https://github.com/heremaps/here-aaa-java-sdk</url>
    </scm>

    <modules>
        <module>here-oauth-client</module>
        <module>examples/here-oauth-client-example</module>
        <module>here-oauth-client-dist</module>
    </modules>

    <properties>

        <!-- Begin From prior parent -->
        <general.encoding>UTF-8</general.encoding>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>${general.encoding}</project.build.sourceEncoding>
        <java.source.linelength>120</java.source.linelength>
        <java.source.tabwidth>4</java.source.tabwidth>
        <project.reporting.outputEncoding>${general.encoding}</project.reporting.outputEncoding>

        <!-- Declare versions for plugins -->
        <jacoco-maven-plugin.version>0.7.5.201505241946</jacoco-maven-plugin.version>
        <maven-assembly-plugin.version>2.6</maven-assembly-plugin.version>
        <maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
        <maven-failsafe-plugin.version>2.19.1</maven-failsafe-plugin.version>
        <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
        <maven-source-plugin.version>2.3</maven-source-plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>        
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>


        <maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
        <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>

        <!-- Declare versions for dependencies -->
        <apache.httpclient.version>4.5.13</apache.httpclient.version>
        <ini4j.version>0.5.4</ini4j.version>
        <jackson.version>2.13.3</jackson.version>
        <junit.version>4.13.1</junit.version>
        <mockito.version>1.10.19</mockito.version>
        <ning.version>1.8.17</ning.version>

        <!-- configure surefire and maven to be individually skippable -->
        <!-- set to skip all tests -->
        <skipTests>false</skipTests>
        <!-- set to skip only unit tests -->
        <skip.unit.tests>${skipTests}</skip.unit.tests>
        <!-- set to skip only integration tests -->
        <skip.integration.tests>${skipTests}</skip.integration.tests>

        <!-- custom properties to support jacoco configuration -->
        <jacoco.it.execution.data.file>${project.build.directory}/coverage-reports/jacoco-it.exec</jacoco.it.execution.data.file>
        <jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.ut.execution.data.file>
        <argLine></argLine>

    </properties>


    <distributionManagement>

        <repository>
            <id>aaa-releases</id>
            <url>${NEXUS_REPO_URL}</url>
        </repository>

        <snapshotRepository>
            <id>aaa-snapshots</id>
            <url>${snapshotServer}</url>
        </snapshotRepository>

    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.ini4j</groupId>
                <artifactId>ini4j</artifactId>
                <version>${ini4j.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${apache.httpclient.version}</version>
            </dependency>

            <!-- test dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.ning</groupId>
                <artifactId>async-http-client</artifactId>
                <version>${ning.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <defaultGoal>package</defaultGoal>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                    <extensions>true</extensions>
                    <configuration>
                        <nexusUrl>https://oss.sonatype.org</nexusUrl>
                        <serverId>aaa-releases</serverId>
                    </configuration>
                    <executions>
                        <execution>
                        <id>default-cli</id>
                        <goals>
                            <goal>rc-list</goal>
                        </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <compilerVersion>${java.version}</compilerVersion>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                        <optimize>false</optimize>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <classpathPrefix>lib/</classpathPrefix>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </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-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                    <configuration>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>${argLine} ${surefireArgLine}</argLine>
                        <skipTests>${skip.unit.tests}</skipTests>
                    </configuration>
                </plugin>
                <!-- Used for integration tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <executions>
                        <!-- Ensures that both integration-test and verify 
                            goals of the Failsafe Maven plugin are executed. -->
                        <execution>
                            <id>integration-tests</id>
                            <goals>
                                <goal>integration-test</goal>
                                <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.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>${jacoco.ut.execution.data.file}</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>${jacoco.ut.execution.data.file}</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                            </configuration>
                        </execution>
                        <!--
                            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>${jacoco.it.execution.data.file}</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>${jacoco.it.execution.data.file}</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                            </configuration>
                        </execution>
                </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>gpg-sign-artifacts</id>
            <activation>
                <property>
                    <name>gpg.passphrase</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <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>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
