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

  <parent>
    <groupId>org.basepom</groupId>
    <artifactId>basepom-standard-oss</artifactId>
    <version>15</version>
    <relativePath />
  </parent>

  <groupId>com.opentable</groupId>
  <artifactId>otj-parent-oss</artifactId>
  <packaging>pom</packaging>
  <version>50</version>
  <name>OpenTable open source base pom</name>

  <description>This is the Base POM for open source OpenTable Maven projects.</description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.targetJdk>1.8</project.build.targetJdk>
    <project.build.generated-resources>${basedir}/target/generated-resources</project.build.generated-resources>
    <ot.build.jvmsize>1024m</ot.build.jvmsize>

    <!-- the current "best" version of maven -->
    <ot.maven.version>3.2.1</ot.maven.version>
    <basepom.maven.version>${ot.maven.version}</basepom.maven.version>

    <!-- -Dot.skip.check-build=true on the command line turns off the various build checkers. -->
    <ot.skip.check-build>false</ot.skip.check-build>
    <ot.javadoc.strict>true</ot.javadoc.strict>

    <dep.scala.version>2.10.6</dep.scala.version>

    <dep.guice.version>4.0</dep.guice.version>
    <ot.logback.version>1.1.5</ot.logback.version>
    <ot.metrics.version>3.1.2</ot.metrics.version>
    <ot.slf4j.version>1.7.16</ot.slf4j.version>
    <dep.jetty.version>9.3.7.v20160115</dep.jetty.version>
    <ot.resteasy.version>3.0.16.Final</ot.resteasy.version>
    <dep.kafka.version>0.9.0.1</dep.kafka.version>

    <ot.build.allow-guice>true</ot.build.allow-guice>
    <ot.build.allow-resteasy>true</ot.build.allow-resteasy>
    <ot.build.allow-joda-time>false</ot.build.allow-joda-time>
    <ot.build.allow-codehaus-jackson>false</ot.build.allow-codehaus-jackson>
    <ot.build.allow-jersey>false</ot.build.allow-jersey>
    <ot.build.allow-otj-httpclient>false</ot.build.allow-otj-httpclient>

    <ot.build.allow-circular-dependencies>false</ot.build.allow-circular-dependencies>

    <basepom.release.push-changes>true</basepom.release.push-changes>
    <basepom.check.checkstyle-severity>warning</basepom.check.checkstyle-severity>
  </properties>

  <prerequisites>
    <maven>${ot.maven.version}</maven>
  </prerequisites>

  <!-- ======================================================================== -->
  <!-- =                                                                      = -->
  <!-- = Build Profile. This is executed every time maven runs unless a       = -->
  <!-- = profile is given on the command line.                                = -->
  <!-- =                                                                      = -->
  <!-- ======================================================================== -->

  <build>
    <!-- Make the artifacts contain the build number for snapshot builds. -->
    <finalName>${ot.build.name}</finalName>

    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
      <resource>
        <directory>${basedir}/src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>${project.build.generated-resources}</directory>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>${basedir}/src/test/resources</directory>
      </testResource>
      <testResource>
        <directory>${basedir}/src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
    </testResources>

    <pluginManagement>
      <plugins>
        <!--
            MAVEN-ENFORCER-PLUGIN (The Loving Iron Fist of Maven™)
            Global banhammer

            Why?  These artifacts are considered hazardous to your health.  Each has its own rationale,
            descibed below inline.
        -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.3.1</version>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.0-beta-3</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>ot</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.skip.check-build}</skip>
                <rules>
                  <bannedDependencies>
                    <!-- Now here is an arcane trick. See http://www.sonatype.com/people/2007/06/how-to-merge-sub-items-from-parent-pom-to-child-pom-in-a-maven-plugin-configuration-2/ for details... -->
                    <excludes combine.children="append">
                      <!-- clashes with commons-logging:commons-logging -->
                      <exclude>commons-logging:commons-logging-api</exclude>
                      <!-- clashes with cglib:cglib-nodep -->
                      <exclude>cglib:cglib</exclude>
                      <!-- logback implements slf4j directly.  No need for slf4j -->
                      <exclude>org.slf4j:slf4j</exclude>
                      <!-- slf4j-simple only allowed for tests -->
                      <exclude>org.slf4j:slf4j-simple:*:*:compile</exclude>
                      <!-- We don't use log4j, use log4j-over-slf4j instead -->
                      <exclude>org.slf4j:slf4j-log4j12</exclude>
                      <!-- junit-dep used to avoid a classless repackaging, but it is now obsoleted -->
                      <exclude>junit:junit-dep</exclude>

                      <!-- No Ness components, port them over. -->
                      <exclude>ness.components:*</exclude>
                      <exclude>com.nesscomputing.components:*</exclude>
                      <exclude>com.nesscomputing.testing:*</exclude>
                      <!-- Trumpet was the code-name for Ness, don't allow that to creep in. -->
                      <exclude>io.trumpet.components:*</exclude>

                      <!-- completely and utterly broken -->
                      <exclude>org.weakref:jmxutils:(,1.11]</exclude>
                      <!-- only the jsr305 jar is allowed, for @SuppressWarnings use our own custom jar -->
                      <exclude>com.google.code.findbugs:jsr305</exclude>
                      <exclude>net.jcip:jcip-annotations</exclude>
                      <!-- replaced with org.kitei.testing:kitei-lessio -->
                      <exclude>ness.kawala:*</exclude>
                      <exclude>com.nesscomputing.testing:testing-lessio</exclude>

                      <!--
                        See: https://groups.google.com/d/msg/dropwizard-user/1usH7frpnZE/RSQUsOBFMsoJ
                        According to Internet Guy, this started out as
                        one of Coda's personal projects, but became
                        sufficiently important to Yammer that they put
                        it under com.yammer.  After that, there was
                        sufficient community involvement that they moved
                        it to io.dropwizard, set up an OSS process, etc.
                        The artifacts with groupId com.codahale.metrics
                        and io.dropwizard.metrics both use class
                        namespace com.codahale.metrics, but we want only
                        the modern io.dropwizard artifacts.
                      -->
                      <exclude>com.codahale.metrics:*</exclude>

                      <!-- OpenTable transitional bans -->
                      <exclude>log4j:log4j</exclude>
                      <exclude>commons-logging:commons-logging</exclude>
                      <exclude>org.jboss.resteasy:jaxrs-api</exclude>
                      <exclude>org.jboss.spec.javax.annotation:*</exclude>
                      <exclude>javax.annotation:jsr250-api</exclude>
                      <exclude>com.opentable.components:otj-tracking</exclude>
                      <exclude>com.opentable.components:otj-httpclient</exclude>
                      <exclude>com.opentable.components:otj-server-templates:(,1.2.0]</exclude>
                      <exclude>com.opentable.components:otj-config:(,1.1.0)</exclude>
                    </excludes>
                  </bannedDependencies>
                  <requireMavenVersion>
                    <version>${ot.maven.version}</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>${project.build.targetJdk}</version>
                  </requireJavaVersion>
                  <requireFilesDontExist>
                    <files>
                      <file>${basedir}/src/main/resources/log4j.xml</file>
                      <file>${basedir}/src/test/resources/log4j.xml</file>
                    </files>
                  </requireFilesDontExist>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of resteasy jackson2 provider -->
            <execution>
              <id>ban-resteasy-jackson2-provider</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-resteasy-jackson2-provider}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>org.jboss.resteasy:resteasy-jackson2-provider</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of joda-time, supplanted by JSR310 time in Java 8 -->
            <execution>
              <id>ban-joda-time</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-joda-time}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>joda-time:joda-time</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of old org.codehaus.jackson artifacts -->
            <execution>
              <id>ban-codehaus-jackson</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-codehaus-jackson}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>org.codehaus.jackson:*</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of Guice, for writing modules which are DI-independent -->
            <execution>
              <id>ban-guice</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-guice}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>com.google.inject</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of RESTeasy, for when you're building Jersey stuff -->
            <execution>
              <id>ban-resteasy</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-resteasy}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>org.jboss.resteasy</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
            <!-- Allow optional banning of Jersey, which we replaced with RESTeasy but
                 some external components still use
              -->
            <execution>
              <id>ban-jersey</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-jersey}</skip>
                <rules>
                  <bannedDependencies combine.children="append">
                    <excludes combine.children="append">
                      <exclude>com.sun.jersey:jersey-core</exclude>
                      <exclude>org.glassfish.jersey.core:jersey-common</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>

            <!-- Ban circular dependencies by default, as they are generally a design smell -->
            <execution>
              <id>ban-circular-dependencies</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <skip>${ot.build.allow-circular-dependencies}</skip>
                <rules>
                  <banCircularDependencies />
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>com.nesscomputing.mojo</groupId>
          <artifactId>numbers-maven-plugin</artifactId>
          <version>2.0</version>
          <executions>
            <execution>
              <id>default-validate</id>
              <phase>validate</phase>
              <goals>
                <goal>get</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <activeGroups>
              <activeGroup>snapshot</activeGroup>
              <activeGroup>release</activeGroup>
            </activeGroups>
            <propertyGroups>
              <propertyGroup>
                <id>snapshot</id>
                <!-- This group is used for the snapshot builds.
                     It generates artifact names with a date
                -->
                <activeOnRelease>false</activeOnRelease>
                <onMissingProperty>ignore</onMissingProperty>
                <properties>
                  <property>
                    <name>ot.build.name</name>
                    <value>${project.artifactId}-${project.version}-#{ot.build.timestamp}_${user.name}</value>
                  </property>
                  <property>
                    <name>ot.build.number</name>
                    <value>#{ot.build.timestamp}_${user.name}</value>
                  </property>
                </properties>
              </propertyGroup>
              <propertyGroup>
                <id>release</id>
                <!-- This group is used for the release builds.
                     It generates normal artifact names
                -->
                <activeOnSnapshot>false</activeOnSnapshot>
                <properties>
                  <property>
                    <name>ot.build.name</name>
                    <value>${project.artifactId}-${project.version}</value>
                  </property>
                  <property>
                    <name>ot.build.number</name>
                    <value>release_${user.name}</value>
                  </property>
                </properties>
              </propertyGroup>
            </propertyGroups>
            <dates>
              <date>
                <export>true</export>
                <id>ot.build.timestamp</id>
                <format>yyyyMMdd_HHmmss</format>
                <timezone>UTC</timezone>
              </date>
            </dates>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>clirr-maven-plugin</artifactId>
          <version>2.6.1</version>
          <configuration>
            <failOnError>true</failOnError>
            <failOnWarning>true</failOnWarning>
            <failOnInfo>false</failOnInfo>
            <minSeverity>info</minSeverity>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- Provide a build number -->
      <plugin>
        <groupId>com.nesscomputing.mojo</groupId>
        <artifactId>numbers-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <!-- Contains a number of "global" dependencies that should never change across our code base. -->
  <dependencyManagement>
    <dependencies>
      <!-- RESTeasy -->
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-guice</artifactId>
        <version>${ot.resteasy.version}</version>
        <exclusions>
          <exclusion>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>${ot.resteasy.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>${ot.resteasy.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
          </exclusion>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
          <exclusion>
            <groupId>net.jcip</groupId>
            <artifactId>jcip-annotations</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>${ot.resteasy.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
          </exclusion>
          <exclusion>
            <groupId>net.jcip</groupId>
            <artifactId>jcip-annotations</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>async-http-servlet-3.0</artifactId>
        <version>${ot.resteasy.version}</version>
      </dependency>

      <!-- Kafka -->
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.10</artifactId>
        <version>${dep.kafka.version}</version>
        <exclusions>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-core</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.10</artifactId>
        <classifier>test</classifier>
        <version>${dep.kafka.version}</version>
        <exclusions>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-core</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka-clients</artifactId>
        <version>${dep.kafka.version}</version>
        <exclusions>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.xerial.snappy</groupId>
        <artifactId>snappy-java</artifactId>
        <version>1.1.2.4</version>
      </dependency>

      <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>3.4.8</version>
        <exclusions>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <!-- config-magic -->
      <dependency>
        <groupId>org.skife.config</groupId>
        <artifactId>config-magic</artifactId>
        <version>0.17</version>
      </dependency>

      <!-- Dropwizard Metrics -->
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-core</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-annotation</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-servlet</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-servlets</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-logback</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-json</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-jetty9</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-jersey</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-jdbi</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-httpclient</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-graphite</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-healthchecks</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>io.dropwizard.metrics</groupId>
        <artifactId>metrics-jvm</artifactId>
        <version>${ot.metrics.version}</version>
      </dependency>
      <dependency>
        <groupId>com.palominolabs.metrics</groupId>
        <artifactId>metrics-guice</artifactId>
        <version>3.1.3</version>
        <exclusions>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <!-- Apache httpclient -->
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.4.1</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.1</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <!-- Java APIs -->
      <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0</version>
      </dependency>
      <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.5</version>
      </dependency>

      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>${dep.findbugs.version}</version>
        <exclusions>
          <exclusion>
            <groupId>net.jcip</groupId>
            <artifactId>jcip-annotations</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <profiles>
    <profile>
      <id>test-log-config</id>
      <activation>
        <file>
          <missing>.no-test-log-config</missing>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.opentable.testing</groupId>
          <artifactId>otj-test-log-config</artifactId>
          <version>1.1.0</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>

    <!-- ======================================================================== -->
    <!-- =                                                                      = -->
    <!-- = Service profile. Builds a tarball which is a deployable unit.        = -->
    <!-- =                                                                      = -->
    <!-- ======================================================================== -->

    <profile>
      <id>build-service</id>
      <activation>
        <file>
          <exists>.build-service</exists>
        </file>
      </activation>
      <properties>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>assemble-app</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                  </descriptorRefs>
                  <archive>
                    <manifest>
                      <mainClass>${ot.mainclass}</mainClass>
                    </manifest>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>check-service-build</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>ot.mainclass</property>
                      <message>You must specify "ot.mainclass" as a Maven property for a service-enabled build.</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifestSections combine.children="append">
                  <manifestSection>
                    <name>${ot.mainclass}</name>
                    <manifestEntries>
                      <X-OT-Binary>${project.artifactId}</X-OT-Binary>
                      <X-OT-Version>${ot.build.number}</X-OT-Version>
                      <X-OT-Mode>service</X-OT-Mode>
                    </manifestEntries>
                  </manifestSection>
                </manifestSections>
              </archive>
            </configuration>
          </plugin>

          <!-- Build a Docker image -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.3.2</version>
            <executions>
              <execution>
                <id>build-docker</id>
                <phase>deploy</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>otpl-package-docker</executable>
                  <arguments>
                    <argument>${project.artifactId}</argument>
                    <argument>${project.build.finalName}</argument>
                    <argument>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- ======================================================================== -->
    <!-- =                                                                      = -->
    <!-- = Clirr Profile. Run clirr to check binary compat of a new release     = -->
    <!-- =                                                                      = -->
    <!-- ======================================================================== -->
    <profile>
      <id>clirr</id>
      <activation>
        <property>
          <name>clirr</name>
        </property>

      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>clirr-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>default-clirr</id>
                <phase>verify</phase>
                <goals>
                  <goal>check-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
