<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2015-2018 The OpenZipkin Authors

    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>io.zipkin.java</groupId>
    <artifactId>parent</artifactId>
    <version>2.7.1</version>
  </parent>

  <artifactId>zipkin-server</artifactId>
  <name>Zipkin Server</name>

  <properties>
    <main.basedir>${project.basedir}/..</main.basedir>
    <main.java.version>1.8</main.java.version>
    <main.signature.artifact>java18</main.signature.artifact>
    <start-class>zipkin.server.ZipkinServer</start-class>
    <maven-invoker-plugin.version>3.0.1</maven-invoker-plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <!-- Import dependency management from Spring Boot -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- reduces http transport latency -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-undertow</artifactId>
    </dependency>

    <!-- zipkin requires exporting /health endpoint -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>io.zipkin.zipkin2</groupId>
      <artifactId>zipkin</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin</artifactId>
    </dependency>

    <!-- Static content for the web UI -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-ui</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Cassandra backend -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-storage-cassandra</artifactId>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>com.datastax.cassandra</groupId>
          <artifactId>cassandra-driver-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- shaded to not interfere with netty 4.1 and boringssl. [JAVA-1241] -->
    <dependency>
      <groupId>com.datastax.cassandra</groupId>
      <artifactId>cassandra-driver-core</artifactId>
      <version>${cassandra-driver-core.version}</version>
      <classifier>shaded</classifier>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.datastax.cassandra</groupId>
      <artifactId>cassandra-driver-mapping</artifactId>
      <version>${cassandra-driver-core.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>com.datastax.cassandra</groupId>
          <artifactId>cassandra-driver-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Cassandra 3 backend -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-storage-cassandra3</artifactId>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>com.datastax.cassandra</groupId>
          <artifactId>cassandra-driver-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.datastax.cassandra</groupId>
          <artifactId>cassandra-driver-mapping</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Elasticsearch http backend -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Elasticsearch aws support -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-storage-elasticsearch-aws</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- MySQL backend -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Kafka Collector -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-collector-kafka</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- RabbitMQ Collector -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-collector-rabbitmq</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Prometheus metrics -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin-autoconfigure-metrics-prometheus</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- Trace api controller activity with Brave -->
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave-instrumentation-okhttp3</artifactId>
      <version>${brave.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave-context-slf4j</artifactId>
      <version>${brave.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>zipkin</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.jayway.jsonpath</groupId>
      <artifactId>json-path</artifactId>
      <version>2.4.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>integration</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>${maven-invoker-plugin.version}</version>
            <configuration>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <settingsFile>src/it/settings.xml</settingsFile>
              <profiles>
                <profile>!release</profile>
              </profiles>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <postBuildHookScript>verify</postBuildHookScript>
              <addTestClassPath>true</addTestClassPath>
              <skipInvocation>${skipTests}</skipInvocation>
              <streamLogs>true</streamLogs>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <classifier>exec</classifier>
          <executable>true</executable>
        </configuration>
      </plugin>
      <!-- disable retrolambda since this module uses java 8 types -->
      <plugin>
        <groupId>net.orfjackal.retrolambda</groupId>
        <artifactId>retrolambda-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
