<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright © 2014-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="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.http</groupId>
  <artifactId>netty-http</artifactId>
  <version>1.5.0</version>
  <packaging>bundle</packaging>
  <name>Netty based path router</name>
  <description>Netty based path router</description>
  <url>https://github.com/cdapio/netty-http</url>

  <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>netty-http-dev@googlegroups.com</email>
      <organization>CDAP</organization>
      <organizationUrl>https://github.com/cdapio/netty-http</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/cdapio/netty-http.git</connection>
    <url>https://github.com/cdapio/netty-http.git</url>
    <developerConnection>scm:git:git@github.com:cdapio/netty-http.git</developerConnection>
    <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>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>

    <rs-api.version>2.0</rs-api.version>
    <netty.version>4.1.16.Final</netty.version>
    <slf4j.version>1.7.5</slf4j.version>
    <findbugs.version>2.0.1</findbugs.version>
    <beanutils.version>1.8.3</beanutils.version>
    <junit.version>4.11</junit.version>
    <logback.version>1.0.9</logback.version>
    <gson.version>2.2.4</gson.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>${rs-api.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-buffer</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-http</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-handler</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>${findbugs.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils-core</artifactId>
      <version>${beanutils.version}</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>${logback.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>${gson.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Compiler -->
      <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>
          <compilerArgs>
            <arg>-Xlint</arg>
          </compilerArgs>
        </configuration>
      </plugin>

      <!-- License RAT check -->
      <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>LICENSE</exclude>
                <exclude>build-number.txt</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Checkstyle -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.17</version>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</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>

      <!-- Surefire -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.14.1</version>
        <configuration>
          <argLine>-Xmx512m</argLine>
          <redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
          <systemPropertyVariables>
            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
          </systemPropertyVariables>
          <includes>
            <include>**/*TestSuite.java</include>
            <include>**/Test*.java</include>
            <include>**/*Test.java</include>
            <include>**/*TestCase.java</include>
          </includes>
        </configuration>
      </plugin>

      <!-- Deploy plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8</version>
        <configuration>
          <deployAtEnd>true</deployAtEnd>
        </configuration>
      </plugin>

      <!-- Bundle plugin -->
      <plugin>
        <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>4.1.0</version>
          <extensions>true</extensions>
          <configuration>
            <instructions>
              <Bundle-Vendor>CDAP</Bundle-Vendor>
                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                <Export-Package>co.cask.http.*;version="1.0.0"</Export-Package>
                <Import-Package>
                  org.jboss.netty.*,
                  com.google.common.*,
                  javax.ws.rs.*,
                  org.slf4j.*,
                  javax.net.ssl.*,
                  org.apache.commons.beanutils.*
                </Import-Package>
                <Embed-Dependency>netty-http</Embed-Dependency>
                <_dsannotations>*</_dsannotations>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- Profile for generating coverage report -->
    <profile>
      <id>coverage</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.14.1</version>
              <configuration>
                <argLine>${argLine} -Xmx512m</argLine>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.jacoco</groupId>
              <artifactId>jacoco-maven-plugin</artifactId>
              <version>0.7.1.201405082137</version>
              <executions>
                <execution>
                  <id>prepare-agent</id>
                  <goals>
                    <goal>prepare-agent</goal>
                  </goals>
                </execution>
                <execution>
                  <id>report</id>
                  <phase>prepare-package</phase>
                  <goals>
                    <goal>report</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>

        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.1.201405082137</version>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Profile for creating all deployment artifacts -->
    <profile>
      <id>release</id>
      <build>
        <pluginManagement>
          <plugins>
            <!-- 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</version>
              <configuration>
                <detectJavaApiLink>true</detectJavaApiLink>
                <links>
                  <link>http://docs.oracle.com/javaee/6/api/</link>
                </links>
                <excludePackageNames>*.internal.*</excludePackageNames>
                <bottom>
                  <![CDATA[Copyright {currentYear} Cask, Inc. <a href="http://www.apache.org/licenses/LICENSE-2.0">Licensed under the 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>

            <!-- GPG signature -->
            <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>

            <!-- Nexus deploy 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>

          </plugins>
        </pluginManagement>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.2</version>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
