<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2016 General Electric Company. 
   
    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at
   
    http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License.
 -->

<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>
    <organization>
        <name>GE Global Research</name>
    </organization>

    <!-- Project information necessary to deploy to Maven Central (see: http://central.sonatype.org/pages/requirements.html) -->
    <groupId>com.ge.predix</groupId>
    <artifactId>acs</artifactId>
    <version>4.7.1</version>
    <packaging>pom</packaging>
    <name>Predix Access Control Services Parent</name>
    <description>Service to enforce authentication and/or authorization of certain resources</description>
    <url>https://github.com/predix/acs</url>
    <developers>
        <developer>
            <id>pdeveloper</id>
            <name>Predix Developer</name>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/predix/acs</url>
    </scm>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
    </parent>

    <modules>
        <module>model</module>
        <module>service</module>
        <module>commons</module>
    </modules>

    <properties>
        <!-- Maven JAVA Version -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven-bundle-plugin.version>2.3.7</maven-bundle-plugin.version>
        <archaius.version>0.7.1</archaius.version>
        <hystrix.version>1.5.2</hystrix.version>
        <!-- Spring framework upgrade to 4.3.1 requires this version of Jackson -->
        <jackson.version>2.6.5</jackson.version>
        <jedis.version>2.8.1</jedis.version>
        <lettuce.version>2.3.3</lettuce.version>
        <springframework.version>4.3.1.RELEASE</springframework.version>
        <springframework-boot.version>1.2.1.RELEASE</springframework-boot.version>
        <spring-metering-filter.version>1.2.1</spring-metering-filter.version>
        <spring-cloud.version>1.0.5.RELEASE</spring-cloud.version>
        <spring-cloud-netflix.version>1.0.7.RELEASE</spring-cloud-netflix.version>
        <spring-data-redis.version>1.6.4.RELEASE</spring-data-redis.version>
        <spring-log-filter.version>1.0.2</spring-log-filter.version>
        <springfox.swagger.version>2.2.2</springfox.swagger.version>
        <google.guava.version>18.0</google.guava.version>
        <swagger.annotations>1.5.0</swagger.annotations>
        <springframework.data.jpa>1.7.2.RELEASE</springframework.data.jpa>
        <h2database.version>1.4.185</h2database.version>
        <flyway.version>3.0</flyway.version>
        <spring-security-oauth2.version>2.0.3.RELEASE</spring-security-oauth2.version>
        <spring-security-jwt.version>1.0.2.RELEASE</spring-security-jwt.version>
        <titandb.version>1.1.0-SNAPSHOT</titandb.version>
        <openjpa.version>2.4.0</openjpa.version>
        <postgres.version>9.3-1103-jdbc4</postgres.version>
        <uaa-token-lib.version>3.2.2</uaa-token-lib.version>
        <audit-sdk.version>0.0.4-SNAPSHOT</audit-sdk.version>

        <!-- Test Dependency Version -->
        <mockito.version>1.9.0</mockito.version>
        <reportng.version>1.1.2</reportng.version>
        <testng.version>6.8</testng.version>
        <cucumber.version>1.2.2</cucumber.version>
        <cucumber.testng.version>1.2.2</cucumber.testng.version>
        <groovy-all.version>2.4.4</groovy-all.version>

    </properties>

    <repositories>
        <repository>
            <id>staging</id>
            <name>Maven Staging Repo</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <distributionManagement>
         <repository>
            <id>artifactory.releases</id>
            <name>artifactory.releases</name>
            <url>https://devcloud.swcoe.ge.com/artifactory/PREDIX</url>
        </repository>
        <snapshotRepository>
            <id>artifactory.snapshots</id>
            <name>artifactory.snapshots</name>
            <url>https://devcloud.swcoe.ge.com/artifactory/PREDIX-SNAPSHOT</url>
        </snapshotRepository>
    </distributionManagement>

    <!-- This allows child modules to use dependency versions declared here. -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.ge.predix</groupId>
                <artifactId>acs-model</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.ge.predix</groupId>
                <artifactId>acs-commons</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>${groovy-all.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox.swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger.annotations}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <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-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox.swagger.version}</version>
        </dependency>

        <!-- Mockito and testng bring their own version of hamcrest as a transitive dependency.
             Place hamcrest above mockito and testng to avoid version mismatch
             that causes NoSuchMethodException -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <!-- For Testing -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <configuration>
                    <allowSnapshots>true</allowSnapshots>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>7.5.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>checkstyle-config/gog-sun-checks-eclipse.xml</configLocation>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <logViolationsToConsole>true</logViolationsToConsole>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <linkXRef>false</linkXRef>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse 
                    m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-checkstyle-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.15,)
                                        </versionRange>
                                        <goals>
                                            <goal>check</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>with.jacoco</id>
            <activation>
                <property>
                    <name>profile-name</name>
                    <value>with.jacoco</value>
                </property>
            </activation>
            <properties>
                <jacoco.version>0.7.2.201409121644</jacoco.version>
                <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
                <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
                <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
                <sonar.language>java</sonar.language>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <configuration>
                            <destFile>${sonar.jacoco.reportPath}</destFile>
                            <append>true</append>
                            <excludes>
                                <exclude>com/ge/predix/acs/model/*.class</exclude>
                                <exclude>com/ge/predix/acs/rest/*.class</exclude>
                                <exclude>com/ge/predix/acs/privilege/management/dao/*.class</exclude>
                                <exclude>com/ge/predix/acs/issuer/management/dao/*.class</exclude>
                                <exclude>com/ge/predix/acs/zone/management/dao/*.class</exclude>
                                <exclude>com/ge/predix/acs/service/policy/admin/dao/*.class</exclude>
                                <exclude>com/ge/predix/acs/jmx/*.class</exclude>
                                <exclude>com/ge/predix/acs/AccessControlService.class</exclude>
                                <exclude>db/postgres/*.class</exclude>
                                <!-- The below classes are covered in integration 
                                    tests and these can be commented back in to get the actual code coverage 
                                    report -->
                                <!-- <exclude>com/ge/predix/acs/privilege/management/ResourcePrivilegeManagementController.class</exclude> 
                                    <exclude>com/ge/predix/acs/monitoring/AcsMonitoringController.class</exclude> 
                                    <exclude>com/ge/predix/acs/privilege/management/SubjectPrivilegeManagementController.class</exclude> 
                                    <exclude>com/ge/predix/acs/service/policy/admin/PolicyManagementController.class</exclude> 
                                    <exclude>com/ge/predix/acs/service/policy/evaluation/PolicyEvaluationController.class</exclude> 
                                    <exclude>com/ge/predix/acs/zone/management/ZoneController.class</exclude> 
                                    <exclude>com/ge/predix/acs/config/CloudDataSourceConfig.class </exclude> -->
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>post-unit-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <distributionManagement>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
            </distributionManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.6</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</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-javadoc-plugin</artifactId>
                        <version>2.9.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
