<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright © 2017-2019 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>io.cdap.plugin</groupId>
  <artifactId>condition-plugins</artifactId>
  <version>1.13.0</version>
  <name>Condition Plugin</name>
  <description>A plugin for making control flow decision within a pipeline</description>
  <packaging>jar</packaging>

  <url>https://github.com/data-integrations/condition-plugins</url>

  <organization>
    <name>CDAP</name>
    <url>http://cdap.io</url>
  </organization>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>CDAP</name>
      <email>cdap-dev@googlegroups.com</email>
      <organization>CDAP</organization>
      <organizationUrl>http://cdap.io</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/data-integrations/condition-plugins.git</connection>
    <developerConnection>scm:git:git@github.com:data-integrations/condition-plugins.git</developerConnection>
    <url>https://github.com/data-integrations/condition-plugins.git</url>
    <tag>HEAD</tag>
  </scm>

  <distributionManagement>
    <repository>
      <id>sonatype.release</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>sonatype.snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <issueManagement>
    <url>https://issues.cask.co/browse/CDAP</url>
  </issueManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <cdap.version>6.9.0</cdap.version>
    <junit.version>4.11</junit.version>
    <guava.version>13.0.1</guava.version>
    <commons-jexl.version>3.0</commons-jexl.version>
    <slf4j.version>1.7.5</slf4j.version>

    <sonar.organization>data-integrations</sonar.organization>
    <sonar.projectKey>${sonar.organization}_${project.artifactId}</sonar.projectKey>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
  </properties>

  <repositories>
    <repository>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/groups/public</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>sonatype-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-api</artifactId>
      <version>${cdap.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-etl-api</artifactId>
      <version>${cdap.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-unit-test</artifactId>
      <version>${cdap.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.hive</groupId>
          <artifactId>hive-exec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.cdap.cdap</groupId>
          <artifactId>cdap-explore-jdbc</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>log4j</artifactId>
          <groupId>log4j</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-jexl3</artifactId>
      <version>${commons-jexl.version}</version>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.10</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.doxia</groupId>
              <artifactId>doxia-core</artifactId>
              <version>1.6</version>
              <exclusions>
                <exclusion>
                  <groupId>xerces</groupId>
                  <artifactId>xercesImpl</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
          <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>**/*.md</exclude>
                  <exclude>**/*.json</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.17</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>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>6.19</version>
            </dependency>
          </dependencies>
        </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.17</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.3.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Embed-Dependency>*;inline=false;scope=compile</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Embed-Directory>lib</Embed-Directory>
            <!--Only @Plugin classes in the export packages will be included as plugin-->
            <_exportcontents>io.cdap.plugin.condition.*</_exportcontents>
          </instructions>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>bundle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.cdap</groupId>
        <artifactId>cdap-maven-plugin</artifactId>
        <version>1.1.0</version>
        <configuration>
          <cdapArtifacts>
            <parent>system:cdap-data-pipeline[6.9.0,7.0.0-SNAPSHOT)</parent>
          </cdapArtifacts>
        </configuration>
        <executions>
          <execution>
            <id>create-artifact-config</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>create-plugin-json</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- Profile for release. Includes building of source and javadoc jars. -->
    <profile>
      <id>release</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-source-plugin</artifactId>
              <version>2.2.1</version>
              <configuration>
                <excludeResources>true</excludeResources>
              </configuration>
              <executions>
                <execution>
                  <id>attach-sources</id>
                  <phase>package</phase>
                  <goals>
                    <goal>jar-no-fork</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>

            <!-- Javadoc jar -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <version>2.9.1</version>
              <configuration>
                <additionalparam>-Xdoclint:none</additionalparam>
                <failOnError>false</failOnError>
                <links>
                  <link>http://download.oracle.com/javase/${jee.version}/docs/api/</link>
                </links>
                <doctitle>${project.name} ${project.version}</doctitle>
                <bottom>
                  <![CDATA[Copyright &#169; {currentYear} <a href="http://cdap.io" target="_blank">CDAP</a> Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>.]]>
                </bottom>
              </configuration>
              <executions>
                <execution>
                  <id>attach-javadoc</id>
                  <phase>package</phase>
                  <goals>
                    <goal>jar</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>

            <plugin>
              <groupId>org.sonatype.plugins</groupId>
              <artifactId>nexus-staging-maven-plugin</artifactId>
              <version>1.6.2</version>
              <extensions>true</extensions>
              <configuration>
                <nexusUrl>https://oss.sonatype.org</nexusUrl>
                <serverId>sonatype.release</serverId>
              </configuration>
            </plugin>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-gpg-plugin</artifactId>
              <version>1.5</version>
              <configuration>
                <passphrase>${gpg.passphrase}</passphrase>
                <useAgent>${gpg.useagent}</useAgent>
              </configuration>
              <executions>
                <execution>
                  <goals>
                    <goal>sign</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>cloudBuild</id>
      <activation>
        <property><name>cloudBuild</name></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <useFile>false</useFile>
              <redirectTestOutputToFile>false</redirectTestOutputToFile>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jdk11</id>
      <activation>
        <jdk>11</jdk>
      </activation>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-annotations</artifactId>
            <exclusions>
              <exclusion>
                <groupId>jdk.tools</groupId>
                <artifactId>jdk.tools</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-annotations</artifactId>
            <exclusions>
              <exclusion>
                <groupId>jdk.tools</groupId>
                <artifactId>jdk.tools</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>
  </profiles>

</project>
