<?xml version="1.0" encoding="UTF-8" ?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with this
  work for additional information regarding copyright ownership. The ASF
  licenses this file to You 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>io.katharsis</groupId>
    <artifactId>katharsis-parent</artifactId>
    <version>1.0.1</version>
  </parent>

  <groupId>com.github.woonsan</groupId>
  <artifactId>katharsis-servlet</artifactId>
  <version>0.1.0</version>
  <packaging>jar</packaging>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Generic Servlet Adapter of Katharsis JSON:API middleware library</description>
  <url>https://github.com/woonsan/katharsis-servlet</url>

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

  <developers>
    <developer>
      <id>woonsan</id>
      <name>Woonsan Ko</name>
      <email>woonsan@apache.org</email>
      <url>https://github.com/woonsan</url>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>America/New_York</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:woonsan/katharsis-servlet.git</connection>
    <developerConnection>scm:git:git@github.com:woonsan/katharsis-servlet.git</developerConnection>
    <url>git@github.com:woonsan/katharsis-servlet.git</url>
  </scm>

  <properties>

    <javax.servlet-api.version>3.0.1</javax.servlet-api.version>
    <katharsis-core.version>0.9.2</katharsis-core.version>
    <guava.version>15.0</guava.version>

    <lib.slf4j.version>1.7.6</lib.slf4j.version>
    <lib.log4j.version>1.2.17</lib.log4j.version>

    <spring.version>3.2.12.RELEASE</spring.version>
    <json-unit.version>1.5.5</json-unit.version>

    <maven-source-plugin.version>2.4</maven-source-plugin.version>
    <maven-javadoc-plugin.version>2.10.2</maven-javadoc-plugin.version>
    <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    <maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
    <maven-jetty-plugin.version>6.1.10</maven-jetty-plugin.version>
    <maven-surefire-report-plugin.version>2.18.1</maven-surefire-report-plugin.version>
    <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>

  </properties>

  <dependencies>

    <dependency>
      <groupId>io.katharsis</groupId>
      <artifactId>katharsis-core</artifactId>
      <version>${katharsis-core.version}</version>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>${javax.servlet-api.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${lib.slf4j.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${lib.slf4j.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${lib.slf4j.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>${lib.log4j.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${spring.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>net.javacrumbs.json-unit</groupId>
      <artifactId>json-unit</artifactId>
      <version>${json-unit.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>${maven-surefire-report-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${cobertura-maven-plugin.version}</version>
        <configuration>
          <formats>
            <format>html</format>
            <format>xml</format>
          </formats>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>

    <!--
      You can run `mvn -Prun clean veryfy' for easier testing at http://localhost:8080/katharsis/.
      Also, you can run the following for remote debugging:

      $ export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
      $ mvn -Prun
    -->

    <profile>

      <id>run</id>

      <dependencies>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>${lib.slf4j.version}</version>
        </dependency>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>${lib.slf4j.version}</version>
          <scope>runtime</scope>
        </dependency>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <version>${lib.slf4j.version}</version>
          <scope>runtime</scope>
        </dependency>

        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>${lib.log4j.version}</version>
          <scope>runtime</scope>
        </dependency>

      </dependencies>

      <build>
        <defaultGoal>initialize</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>${maven-jetty-plugin.version}</version>
            <executions>
              <execution>
                <id>cargo-run</id>
                <phase>validate</phase>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <contextPath>/katharsis</contextPath>
              <webAppSourceDirectory>${basedir}/src/test/webapp</webAppSourceDirectory>
              <classesDirectory>${basedir}/target/classes,${basedir}/target/test-classes</classesDirectory>
              <systemProperties>
                <systemProperty>
                  <name>log4j.configuration</name>
                  <value>file://${basedir}/src/test/resources/log4j.xml</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile> 
      <id>ossrh-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.3</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>sonatype-nexus-staging</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
