<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright © 2014 Cask Data, Inc.

  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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

 <parent>
    <groupId>co.cask.cdap</groupId>
    <artifactId>cdap-clients</artifactId>
    <version>1.0.0</version>
  </parent>

  <artifactId>cdap-authentication-clients</artifactId>
  <packaging>pom</packaging>
  <name>CDAP Authentication clients</name>
  <description>CDAP Authentication Clients</description>
  <url>https://github.com/caskdata/cdap-clients</url>

  <modules>
    <module>java</module>
  </modules>

  <properties>
    <cdap.version>2.5.0-SNAPSHOT</cdap.version>
    <commons.lang.version>2.5</commons.lang.version>
    <logback.version>1.0.9</logback.version>
    <log4j.over.slf4j.version>1.7.7</log4j.over.slf4j.version>
    <gson.version>2.2.4</gson.version>
    <guava.version>13.0.1</guava.version>
    <rs-api.version>2.0</rs-api.version>
    <jersey.version>2.4.1</jersey.version>
    <mockito.version>1.9.5</mockito.version>
    <junit.version>4.11</junit.version>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.14.1</version>
          <configuration>
            <argLine>-Xmx4096m -Djava.awt.headless=true -XX:MaxPermSize=256m</argLine>
            <redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
            <reuseForks>false</reuseForks>
            <reportFormat>plain</reportFormat>
            <systemPropertyVariables>
              <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
            </systemPropertyVariables>
            <includes>
              <include>**/*TestsSuite.java</include>
              <include>**/Test*.java</include>
              <include>**/*Test.java</include>
              <include>**/*TestCase.java</include>
            </includes>
            <excludes>
              <exclude>**/*TestRun.java</exclude>
            </excludes>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>surefire-junit47</artifactId>
              <version>2.14</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.10</version>
          <executions>
            <execution>
              <id>rat-check</id>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <excludes>
                  <exclude>build-number.txt</exclude>
                  <exclude>LICENSE*.txt</exclude>
                  <exclude>*.rst</exclude>
                  <exclude>**/*.md</exclude>
                  <exclude>**/*.json</exclude>
                  <exclude>logs/**</exclude>
                  <exclude>docs/**</exclude>
                  <exclude>conf/**</exclude>
                  <exclude>data/**</exclude>
                  <exclude>**/Apache-LICENSE-2.0</exclude>
                  <exclude>**/VERSION</exclude>
                  <exlcude>**/*.patch</exlcude>
                  <exclude>**/logrotate.d/**</exclude>
                  <exclude>**/limits.d/**</exclude>
                  <!-- Excludes AVRO schema files -->
                  <exclude>**/*.avsc</exclude>
                  <!-- Excludes examples by default, include it in the examples profile -->
                  <exclude>examples/**</exclude>
                  <exclude>**/testlogs/**</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.12.1</version>
          <executions>
            <execution>
              <id>validate</id>
              <phase>process-test-classes</phase>
              <configuration>
                <configLocation>checkstyle.xml</configLocation>
                <suppressionsLocation>suppressions.xml</suppressionsLocation>
                <encoding>UTF-8</encoding>
                <consoleOutput>true</consoleOutput>
                <failsOnError>true</failsOnError>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
              </configuration>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.10</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.12.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.14.1</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dist</id>
      <properties>
        <python.dir>${project.build.directory}/cdap-authentication-clients</python.dir>
        <python.stage.dir>${python.dir}/cdap-python-authentication-client-${project.version}</python.stage.dir>
        <deploy.url>https://repository.continuuity.com/service/local/staging/deploy/maven2</deploy.url>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>copy-opt</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration combine.self="override">
                  <outputDirectory>${python.stage.dir}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${project.basedir}/python</directory>
                      <filtering>true</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>python-package</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration combine.self="override">
                  <descriptors>
                    <descriptor>${project.basedir}/assembly/python-package.xml</descriptor>
                  </descriptors>
                  <appendAssemblyId>false</appendAssemblyId>
                  <attach>false</attach>
                  <finalName>cdap-python-authentication-client-${project.version}</finalName>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>deploy-python</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy-file</goal>
                </goals>
                <configuration>
                  <version>${project.version}</version>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>cdap-python-authentication-client</artifactId>
                  <packaging>zip</packaging>
                  <generatePom>false</generatePom>
                  <file>${project.build.directory}/cdap-python-authentication-client-${project.version}.zip</file>
                  <repositoryId>continuuity</repositoryId>
                  <url>${deploy.url}</url>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
