<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright © 2020 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>

  <groupId>io.cdap.plugin</groupId>
  <artifactId>servicenow-plugins</artifactId>
  <version>1.1.0</version>
  <name>ServiceNow Plugins</name>
  <packaging>jar</packaging>
  <description>Plugins for ServiceNow</description>
  <url>https://github.com/data-integrations/servicenow</url>

  <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>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/servicenow-plugins.git</connection>
    <developerConnection>scm:git:git@github.com:data-integrations/servicenow-plugins.git</developerConnection>
    <url>https://github.com/data-integrations/servicenow-plugins.git</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <!-- 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-data-pipeline[6.1.1,7.0.0-SNAPSHOT)</app.parents>
    <!-- this is here because project.basedir evaluates to null in the script build step -->
    <main.basedir>${project.basedir}</main.basedir>
    <jee.version>7</jee.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <cdap.version>6.1.1</cdap.version>
    <cdap.plugin.version>2.3.4</cdap.plugin.version>
    <hadoop.version>2.9.2</hadoop.version>
    <httpclient.version>4.3.4</httpclient.version>
    <jackson.core.version>2.8.11.1</jackson.core.version>
    <junit.version>4.12</junit.version>
    <slf4j.version>1.7.5</slf4j.version>
    <powermock.version>2.0.2</powermock.version>
    <testSourceLocation>${project.basedir}/src/test/java/</testSourceLocation>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </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>

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/groups/public</url>
    </pluginRepository>
  </pluginRepositories>

  <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>

  <dependencies>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-etl-api</artifactId>
      <version>${cdap.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.cdap.plugin</groupId>
      <artifactId>hydrator-common</artifactId>
      <version>${cdap.plugin.version}</version>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>cdap-data-pipeline</artifactId>
      <version>${cdap.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.cdap.cdap</groupId>
      <artifactId>hydrator-test</artifactId>
      <version>${cdap.version}</version>
      <scope>test</scope>
    </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>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>${httpclient.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.oltu.oauth2</groupId>
      <artifactId>org.apache.oltu.oauth2.client</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>2.24.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.rholder</groupId>
      <artifactId>guava-retrying</artifactId>
      <version>2.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito2</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.2.8</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>${testSourceLocation}</testSourceDirectory>
    <plugins>
      <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>
              <testSourceDirectories>
                <testSourceDirectory>src/test/java</testSourceDirectory>
                <testSourceDirectory>src/e2e-test/java</testSourceDirectory>
              </testSourceDirectories>
            </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-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.2</version>
        <executions>
          <execution>
            <id>default-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <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>target/jacoco.exec</dataFile>
              <!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>target/jacoco-ut</outputDirectory>

            </configuration>
          </execution>
        </executions>
        <configuration>
          <propertyName>surefireArgLine</propertyName>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.14.1</version>
        <configuration>
          <argLine>${surefireArgLine} -Xmx5000m -Djava.awt.headless=true -XX:MaxPermSize=1024m -XX:+UseConcMarkSweepGC -XX:OnOutOfMemoryError="kill -9 %p" -Djava.net.preferIPv4Stack=true</argLine>
          <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>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.5.1</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.*;
            </_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.1.1,7.0.0-SNAPSHOT)</parent>
            <parent>system:cdap-data-streams[6.1.1,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>
      <id>e2e-tests</id>
      <properties>
        <testSourceLocation>src/e2e-test/java</testSourceLocation>
      </properties>
      <build>
        <testResources>
          <testResource>
            <directory>src/e2e-test/resources</directory>
          </testResource>
        </testResources>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
              <includes>
                <include>TestRunner.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.5.0</version>
            <executions>
              <execution>
                <id>execution</id>
                <phase>verify</phase>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <projectName>Cucumber Reports</projectName> <!-- Replace with project name -->
                  <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                  <buildNumber>1</buildNumber>
                  <skip>false</skip>
                  <inputDirectory>${project.build.directory}/cucumber-reports</inputDirectory>
                  <jsonFiles> <!-- supports wildcard or name pattern -->
                    <param>**/*.json</param>
                  </jsonFiles> <!-- optional, defaults to outputDirectory if not specified -->
                  <classificationDirectory>${project.build.directory}/cucumber-reports</classificationDirectory>
                  <checkBuildResult>true</checkBuildResult>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>31.0.1-jre</version>
            <scope>compile</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>io.cdap.tests.e2e</groupId>
          <artifactId>cdap-e2e-framework</artifactId>
          <version>0.0.1-SNAPSHOT</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <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>
            </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>
              <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.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>
