<?xml version="1.0"?>
<!--
   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>
    <artifactId>bookkeeper</artifactId>
    <groupId>org.apache.bookkeeper</groupId>
    <version>4.6.2</version>
  </parent>
  <artifactId>bookkeeper-server</artifactId>
  <name>Apache BookKeeper :: Server</name>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.libdir>${basedir}/lib</project.libdir>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.apache.bookkeeper</groupId>
      <artifactId>bookkeeper-common</artifactId>
      <version>${project.parent.version}</version>
      <exclusions>
        <!-- exclude "netty-common" since "netty-all" already introduces it -->
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-common</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>${protobuf.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
      <version>${zookeeper.version}</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>net.java.dev.javacc</groupId>
          <artifactId>javacc</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
	</exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
      <version>${zookeeper.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.6</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
      <version>4.1</version>
    </dependency>
    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>3.2.7</version>
    </dependency>
    <!--
        Annoying dependency we need to include because
        zookeeper uses log4j and so we transatively do, but
        log4j has some dependencies which aren't in the
        default maven repositories
    //-->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.15</version>
      <exclusions>
        <exclusion>
          <groupId>javax.mail</groupId>
          <artifactId>mail</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.jms</groupId>
          <artifactId>jms</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jdmk</groupId>
          <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jmx</groupId>
          <artifactId>jmxri</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.bookkeeper</groupId>
      <artifactId>bookkeeper-common</artifactId>
      <version>${project.parent.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-minikdc</artifactId>
      <version>2.7.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-tcnative-boringssl-static</artifactId>
      <version>${netty-boringssl.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.bookkeeper.http</groupId>
      <artifactId>http-server</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <!-- for mini-kdc -->
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.2.0</version>
        <inherited>true</inherited>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <configuration>
          <!-- put your configurations here -->
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>true</createDependencyReducedPom>
              <promoteTransitiveDependencies>false</promoteTransitiveDependencies>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>shaded</shadedClassifierName>
              <minimizeJar>true</minimizeJar>
              <shadeTestJar>true</shadeTestJar>
              <artifactSet>
                <includes>
                  <include>com.google.guava:guava</include>
                  <include>com.google.protobuf:protobuf-java</include>
                  <include>org.apache.bookkeeper:bookkeeper-common</include>
                  <include>org.apache.bookkeeper:bookkeeper-proto</include>
                  <include>org.apache.bookkeeper.stats:bookkeeper-stats-api</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google</pattern>
                  <shadedPattern>org.apache.bookkeeper.shaded.com.google</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- exclude generated file //-->
            <exclude>**/DataFormats.java</exclude>
            <exclude>**/BookkeeperProtocol.java</exclude>
            <exclude>**/target/**/*</exclude>
            <exclude>**/.classpath</exclude>
            <exclude>**/.gitignore</exclude>
            <exclude>**/.project</exclude>
            <exclude>**/.settings/*</exclude>
            <exclude>certs/keyStoreClientPassword.txt</exclude>
            <exclude>certs/keyStoreServerPassword.txt</exclude>
            <exclude>certs/trustStorePassword.txt</exclude>
            <exclude>src/test/resources/cacerts</exclude>
            <exclude>src/test/resources/keyStoreClientPassword.txt</exclude>
            <exclude>src/test/resources/keyStoreServerPassword.txt</exclude>
            <exclude>src/test/resources/trustStorePassword.txt</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.libdir}</outputDirectory>
	      <includeScope>runtime</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
	<configuration>
	  <filesets>
            <fileset>
              <directory>${project.libdir}</directory>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
	</configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <configuration>
          <!-- Avoid for missing javadoc comments to be marked as errors -->
          <additionalparam>-Xdoclint:none</additionalparam>
          <subpackages>org.apache.bookkeeper.client:org.apache.bookkeeper.common.annotation:org.apache.bookkeeper.conf:org.apache.bookkeeper.feature:org.apache.bookkeeper.stats</subpackages>
          <groups>
            <group>
              <title>Bookkeeper</title>
              <packages>org.apache.bookkeeper*</packages>
            </group>
          </groups>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.5.0</version>
        <configuration>
          <protocArtifact>com.google.protobuf:protoc:3.4.0:exe:${os.detected.classifier}</protocArtifact>
          <checkStaleness>true</checkStaleness>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${puppycrawl.checkstyle.version}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.bookkeeper</groupId>
            <artifactId>buildtools</artifactId>
            <version>${project.parent.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>bookkeeper/checkstyle.xml</configLocation>
          <suppressionsLocation>bookkeeper/server-suppressions.xml</suppressionsLocation>
          <consoleOutput>true</consoleOutput>
          <failOnViolation>true</failOnViolation>
          <includeResources>false</includeResources>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
        </configuration>
        <executions>
          <execution>
            <id>checkstyle</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>twitter-science-provider</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.bookkeeper.stats</groupId>
          <artifactId>twitter-science-provider</artifactId>
          <version>${project.parent.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>dev</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
              <argLine>-Xmx2G -Djava.net.preferIPv4Stack=true</argLine>
              <redirectTestOutputToFile>false</redirectTestOutputToFile>
              <reuseForks>false</reuseForks>
              <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
              <trimStackTrace>false</trimStackTrace>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>dev-debug</id>
      <build>
          <plugins>
          <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-checkstyle-plugin</artifactId>
               <configuration>
                   <skip>true</skip>
               </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>${maven-surefire-plugin.version}</version>
              <configuration>
                <argLine>-Xmx2G -Djava.net.preferIPv4Stack=true -Dbookkeeper.root.logger=DEBUG,CONSOLE</argLine>
                <redirectTestOutputToFile>false</redirectTestOutputToFile>
                <reuseForks>false</reuseForks>
                <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
                <trimStackTrace>false</trimStackTrace>
              </configuration>
            </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>codahale-metrics-provider</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.bookkeeper.stats</groupId>
          <artifactId>codahale-metrics-provider</artifactId>
          <version>${project.parent.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>twitter-http-server</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.bookkeeper.http</groupId>
          <artifactId>twitter-http-server</artifactId>
          <version>${project.parent.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>vertx-http-server</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.bookkeeper.http</groupId>
          <artifactId>vertx-http-server</artifactId>
          <version>${project.parent.version}</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
