<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright © 2015-2016 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>co.cask.hydrator</groupId>
  <artifactId>hydrator-plugins</artifactId>
  <version>1.7.0</version>
  <packaging>pom</packaging>
  <name>Hydrator Plugin Collection</name>
  <description>A collection of plugins for Cask Hydrator.</description>
  <url>https://github.com/caskdata/hydrator-plugins</url>

  <modules>
    <module>hydrator-common</module>
    <module>core-plugins</module>
    <module>cassandra-plugins</module>
    <module>database-plugins</module>
    <module>elasticsearch-plugins</module>
    <module>hbase-plugins</module>
    <module>hdfs-plugins</module>
    <module>hive-plugins</module>
    <module>http-plugins</module>
    <module>kafka-plugins</module>
    <module>mongodb-plugins</module>
    <module>solrsearch-plugins</module>
    <module>spark-plugins</module>
    <module>transform-plugins</module>
    <module>wrangler-transform</module>
  </modules>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Cask Data</name>
      <email>cask-dev@googlegroups.com</email>
      <organization>Cask Data, Inc.</organization>
      <organizationUrl>http://www.cdap.io</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/caskdata/hydrator-plugins.git</connection>
    <developerConnection>scm:git:git@github.com:caskdata/hydrator-plugins.git</developerConnection>
    <url>https://github.com/caskdata/hydrator-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>
    <site>
      <id>cask</id>
      <url>http://cask.co</url>
    </site>
  </distributionManagement>

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

  <properties>
    <jee.version>7</jee.version>
    <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- version properties -->
    <apache-commons.version>1.2</apache-commons.version>
    <asm.version>5.0.3</asm.version>
    <avro.version>1.7.7</avro.version>
    <cassandra.version>2.1.0</cassandra.version>
    <cassandraunit.version>2.0.2.2</cassandraunit.version>
    <commons-codec.version>1.10</commons-codec.version>
    <commons-httpclient.version>3.1</commons-httpclient.version>
    <cdap.version>4.2.0</cdap.version>
    <datastax.version>2.0.5</datastax.version>
    <dumbster.version>1.6</dumbster.version>
    <es.version>1.6.0</es.version>
    <es-hadoop.version>2.1.0</es-hadoop.version>
    <fastutil.version>6.6.1</fastutil.version>
    <geronimo-jms.version>1.1.1</geronimo-jms.version>
    <guava.version>13.0.1</guava.version>
    <hadoop.version>2.3.0</hadoop.version>
    <hsql.version>2.2.4</hsql.version>
    <cdh.hive.version>1.1.0-cdh5.5.1</cdh.hive.version>
    <javamail.version>1.4.1</javamail.version>
    <junit.version>4.11</junit.version>
    <kafka.version>0.8.2.2</kafka.version>
    <mockftp.version>2.6</mockftp.version>
    <snappy.version>1.1.2</snappy.version>
    <slf4j.version>1.7.5</slf4j.version>
    <twill.version>0.9.0</twill.version>
    <twitter4j.version>4.0.3</twitter4j.version>
    <zookeeper.version>3.4.5</zookeeper.version>
    <jython.version>2.5.2</jython.version>
    <json-path.version>2.2.0</json-path.version>
    <json.version>20160212</json.version>
    <!-- properties for script build step that creates the config files for the artifacts -->
    <widgets.dir>widgets</widgets.dir>
    <docs.dir>docs</docs.dir>
    <app.parents>system:cdap-etl-batch[4.2.0,4.3.0-SNAPSHOT),system:cdap-etl-realtime[4.2.0,4.3.0-SNAPSHOT),system:cdap-data-pipeline[4.2.0,4.3.0-SNAPSHOT),system:cdap-data-streams[4.2.0,4.3.0-SNAPSHOT)</app.parents>
    <!-- this is here because project.basedir evaluates to null in the script build step -->
    <main.basedir>${project.basedir}</main.basedir>
  </properties>



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

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>jsr250-api</artifactId>
        <version>1.0</version>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-api</artifactId>
        <version>${cdap.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-api-spark</artifactId>
        <version>${cdap.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-etl-proto</artifactId>
        <version>${cdap.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-etl-api</artifactId>
        <version>${cdap.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-etl-api-spark</artifactId>
        <version>${cdap.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-formats</artifactId>
        <version>${cdap.version}</version>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-data-pipeline</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-data-streams</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>hydrator-test</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-etl-realtime</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-test</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>co.cask.cdap</groupId>
        <artifactId>cdap-unit-test</artifactId>
        <version>${cdap.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-minicluster</artifactId>
        <version>${hadoop.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.version}</version>
        <scope>provided</scope>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
          </exclusion>
          <exclusion>
            <artifactId>jersey-core</artifactId>
            <groupId>com.sun.jersey</groupId>
          </exclusion>
          <exclusion>
            <artifactId>jersey-json</artifactId>
            <groupId>com.sun.jersey</groupId>
          </exclusion>
          <exclusion>
            <artifactId>jersey-server</artifactId>
            <groupId>com.sun.jersey</groupId>
          </exclusion>
          <exclusion>
            <artifactId>servlet-api</artifactId>
            <groupId>javax.servlet</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-util</artifactId>
          </exclusion>
          <exclusion>
            <artifactId>jasper-compiler</artifactId>
            <groupId>tomcat</groupId>
          </exclusion>
          <exclusion>
            <artifactId>jasper-runtime</artifactId>
            <groupId>tomcat</groupId>
          </exclusion>
          <exclusion>
            <artifactId>jsp-api</artifactId>
            <groupId>javax.servlet.jsp</groupId>
          </exclusion>
          <exclusion>
            <artifactId>slf4j-api</artifactId>
            <groupId>org.slf4j</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-mapreduce-client-core</artifactId>
        <version>${hadoop.version}</version>
        <scope>provided</scope>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-servlet</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-guice</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-all</artifactId>
        <version>${cassandra.version}</version>
      </dependency>
      <dependency>
        <groupId>org.xerial.snappy</groupId>
        <artifactId>snappy-java</artifactId>
        <version>${snappy.version}</version>
      </dependency>
      <dependency>
        <groupId>org.cassandraunit</groupId>
        <artifactId>cassandra-unit</artifactId>
        <version>${cassandraunit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-core</artifactId>
        <version>${datastax.version}</version>
      </dependency>
      <dependency>
        <groupId>org.twitter4j</groupId>
        <artifactId>twitter4j-core</artifactId>
        <version>${twitter4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.twitter4j</groupId>
        <artifactId>twitter4j-stream</artifactId>
        <version>${twitter4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.mockftpserver</groupId>
        <artifactId>MockFtpServer</artifactId>
        <version>${mockftp.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>${hsql.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${es.version}</version>
        <exclusions>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>*</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.ow2.asm</groupId>
            <artifactId>*</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-servlet</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-guice</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch-hadoop-mr</artifactId>
        <version>${es-hadoop.version}</version>
      </dependency>
      <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>${commons-httpclient.version}</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro</artifactId>
        <version>${avro.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-mapred</artifactId>
        <classifier>hadoop2</classifier>
        <version>${avro.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jms_1.1_spec</artifactId>
        <version>${geronimo-jms.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>${zookeeper.version}</version>
        <scope>provided</scope>
        <exclusions>
          <exclusion>
            <artifactId>slf4j-api</artifactId>
            <groupId>org.slf4j</groupId>
          </exclusion>
          <exclusion>
            <artifactId>slf4j-log4j12</artifactId>
            <groupId>org.slf4j</groupId>
          </exclusion>
          <exclusion>
            <artifactId>log4j</artifactId>
            <groupId>log4j</groupId>
          </exclusion>
          <exclusion>
            <artifactId>junit</artifactId>
            <groupId>junit</groupId>
          </exclusion>
          <exclusion>
            <groupId>org.jboss.netty</groupId>
            <artifactId>netty</artifactId>
          </exclusion>
          <exclusion>
            <groupId>jline</groupId>
            <artifactId>jline</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.twill</groupId>
        <artifactId>twill-core</artifactId>
        <version>${twill.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.10</artifactId>
        <version>${kafka.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jdmk</groupId>
            <artifactId>jmxtools</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jmx</groupId>
            <artifactId>jmxri</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm-all</artifactId>
        <version>${asm.version}</version>
      </dependency>
      <dependency>
        <groupId>org.python</groupId>
        <artifactId>jython-standalone</artifactId>
        <version>${jython.version}</version>
      </dependency>
      <dependency>
        <groupId>dumbster</groupId>
        <artifactId>dumbster</artifactId>
        <version>${dumbster.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>${javamail.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-streaming-twitter_2.10</artifactId>
        <version>1.6.2</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.14.1</version>
        <configuration>
          <argLine>-Xmx3g -Djava.awt.headless=true -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -Djava.net.preferIPv4Stack=true</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>**/*TestSuite.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>
        <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>LICENSE*.txt</exclude>
                <!-- This file should be not be there, but I am excluding it for now -->
                <exclude>*.rst</exclude>
                <exclude>*.md</exclude>
                <exclude>**/*.cdap</exclude>
                <exclude>**/*.yaml</exclude>
                <exclude>**/*.md</exclude>
                <exclude>logs/**</exclude>
                <exclude>.git/**</exclude>
                <exclude>.idea/**</exclude>
                <exclude>**/grok/patterns/**</exclude>
                <exclude>conf/**</exclude>
                <exclude>data/**</exclude>
                <exclude>plugins/**</exclude>
                <exlcude>**/*.patch</exlcude>
                <exclude>**/logrotate.d/**</exclude>
                <exclude>**/limits.d/**</exclude>
                <exclude>**/*.json</exclude>
                <exclude>**/*.json.template</exclude>
                <exclude>**/MANIFEST.MF</exclude>
                <!-- exclude any hack classes -->
                <exclude>**/org/apache/hadoop/**</exclude>
                <!-- exclude resource files-->
                <exclude>**/resources/**</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>
              <excludes>**/org/apache/cassandra/**,**/org/apache/hadoop/**</excludes>
            </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>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <!-- Create the config file for artifact which can be used to deploy the artifact.
               Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever
               version range is set in the app.parents property.
               also sets a widget and doc property for each file contained in the widgets and docs directories. -->
          <execution>
            <id>create-artifact-config</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <script language="javascript"> <![CDATA[

                  // for some reason, project.basedir evaluates to null if we just get the property here.
                  // so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here
                  // where it evaluates correctly for whatever reason
                  var baseDir = project.getProperty("main.basedir");
                  var targetDir = project.getProperty("project.build.directory");
                  var artifactId = project.getProperty("project.artifactId");
                  var version = project.getProperty("project.version");

                  var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json");
                  if (!cfgFile.exists()) {
                    cfgFile.createNewFile();
                  }

                  var parents = project.getProperty("app.parents").split(",");
                  var config = {
                    "parents": [ ],
                    "properties": {}
                  }
                  for (i = 0; i < parents.length; i+=2) {
                    // because name1[lo,hi],name2[lo,hi] gets split into "name1[lo", "hi]", "name2[lo", "hi]"
                    // so we have to combine them again
                    config.parents.push(parents[i] + "," + parents[i+1]);
                  }

                  // look in widgets directory for widget config for each plugin
                  var widgetsDir = new java.io.File(baseDir, project.getProperty("widgets.dir"));
                  if (widgetsDir.isDirectory()) {
                    var widgetsFiles = widgetsDir.listFiles();
                    for (i = 0; i < widgetsFiles.length; i++) {
                      var widgetsFile = widgetsFiles[i];
                      if (widgetsFile.isFile()) {
                        var propertyName = "widgets." + widgetsFile.getName();
                        // if the filename ends with .json
                        if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) {
                          // strip the .json
                          propertyName = propertyName.slice(0, -5);
                          var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
                          var contentsAsJson = JSON.parse(contents);
                          config.properties[propertyName] = JSON.stringify(contentsAsJson);
                        }
                      }
                    }
                  }

                  // look in the docs directory for docs for each plugin
                  var docsDir = new java.io.File(baseDir, project.getProperty("docs.dir"));
                  if (docsDir.isDirectory()) {
                    var docFiles = docsDir.listFiles();
                    for (i = 0; i < docFiles.length; i++) {
                      var docFile = docFiles[i];
                      if (docFile.isFile()) {
                        var propertyName = "doc." + docFile.getName();
                        // if the filename ends with .md
                        if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) {
                          // strip the extension
                          propertyName = propertyName.slice(0, -3);
                          var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
                          config.properties[propertyName] = contents + "";
                        }
                      }
                    }
                  }

                  var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile()));
                  fw.write(JSON.stringify(config, null, 2));
                  fw.close();
                ]]></script>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <!-- Profile for release. Includes signing of jars. -->
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <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>
              <stagingProfileId>655dc88dc770c3</stagingProfileId>
            </configuration>
          </plugin>
          <!-- Source JAR -->
          <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>
              <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://cask.co" target="_blank">Cask Data, Inc.</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.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>
      </build>
    </profile>
  </profiles>
</project>
