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

    Copyright 2016-2019 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>
  <groupId>io.zipkin.brave.ratpack</groupId>
  <artifactId>brave-ratpack</artifactId>
  <version>2.3.2</version>
  <packaging>jar</packaging>
  <name>brave-ratpack</name>
  <description>Brave instrumentation for Ratpack</description>
  <inceptionYear>2016</inceptionYear>
  <url>https://github.com/openzipkin-contrib/brave-ratpack</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <main.basedir>${project.basedir}</main.basedir>

    <!-- override to set exclusions per-project -->
    <errorprone.args />
    <errorprone.version>2.3.2</errorprone.version>
    <plexus-compiler-javac-errorprone.version>2.8.4</plexus-compiler-javac-errorprone.version>

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <main.signature.artifact>java18</main.signature.artifact>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
    <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
    <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    <maven-failsafe-plugin.version>3.0.0-M2</maven-failsafe-plugin.version>
    <license-maven-plugin.version>3.0</license-maven-plugin.version>

    <brave.version>5.1.5</brave.version>
    <ratpack.version>1.4.6</ratpack.version>

  </properties>

  <organization>
    <name>OpenZipkin</name>
    <url>http://zipkin.io/</url>
  </organization>

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

  <scm>
    <url>https://github.com/openzipkin-contrib/brave-ratpack</url>
    <connection>scm:git:https://github.com/openzipkin-contrib/brave-ratpack.git</connection>
    <developerConnection>scm:git:https://github.com/openzipkin-contrib/brave-ratpack.git</developerConnection>
    <tag>2.3.2</tag>
  </scm>

  <!-- Developer section is needed for Maven Central, but doesn't need to include each person -->
  <developers>
    <developer>
      <id>openzipkin</id>
      <name>OpenZipkin Gitter</name>
      <url>https://gitter.im/openzipkin/zipkin</url>
    </developer>
  </developers>

  <distributionManagement>
    <repository>
      <id>bintray</id>
      <name>bintray</name>
      <url>https://api.bintray.com/maven/openzipkin-contrib/maven/brave-ratpack/;publish=1</url>
    </repository>
    <snapshotRepository>
      <id>jfrog-snapshots</id>
      <url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>
    </snapshotRepository>
  </distributionManagement>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/openzipkin-contrib/brave-opentracing/issues</url>
  </issueManagement>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <!-- select non-aggregate reports -->
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.zipkin.brave</groupId>
        <artifactId>brave-bom</artifactId>
        <version>${brave.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave</artifactId>
    </dependency>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave-instrumentation-http</artifactId>
    </dependency>

    <dependency>
      <groupId>io.ratpack</groupId>
      <artifactId>ratpack-guice</artifactId>
      <version>${ratpack.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.13</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <!-- any version of Groovy \>= 1.5.0 should work here -->
      <version>2.4.6</version>
      <type>pom</type>
    </dependency>
    <!-- Test dependencies -->
    <!-- Mandatory dependencies for using Spock -->
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-core</artifactId>
      <version>1.1-groovy-2.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.9.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-nop</artifactId>
      <version>1.7.21</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.ratpack</groupId>
      <artifactId>ratpack-groovy-test</artifactId>
      <version>${ratpack.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave-instrumentation-http-tests</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>mockwebserver</artifactId>
      <version>3.11.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Mandatory plugins for using Spock -->
      <plugin>
        <!-- The gmavenplus plugin is used to compile Groovy code. To learn more about this plugin,
        visit https://github.com/groovy/GMavenPlus/wiki -->
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <goals>
              <goal>compileTests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20.1</version>
        <configuration>
          <useFile>false</useFile>
          <includes>
            <include>**/*Spec.java</include>
            <include>**/IT*.java</include>
          </includes>
          <systemPropertyVariables>
            <java.util.logging.manager>org.apache.logging.log4j.jul.LogManager
            </java.util.logging.manager>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <inherited>true</inherited>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <!-- only use errorprone on main source tree -->
            <configuration>
              <compilerId>javac-with-errorprone</compilerId>
              <forceJavacCompilerUse>true</forceJavacCompilerUse>
              <showWarnings>true</showWarnings>
              <compilerArgs>
                <arg>-XepDisableWarningsInGeneratedCode</arg>
              </compilerArgs>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-compiler-javac-errorprone</artifactId>
            <version>${plexus-compiler-javac-errorprone.version}</version>
          </dependency>
          <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_core</artifactId>
            <version>${errorprone.version}</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-failsafe-plugin.version}</version>
        <!-- Try to prevent flakes in circleci -->
        <configuration>
          <reuseForks>false</reuseForks>
          <systemPropertyVariables>
            <java.util.logging.manager>org.apache.logging.log4j.jul.LogManager
            </java.util.logging.manager>
          </systemPropertyVariables>
        </configuration>
      </plugin>

       <!--mvn -N io.takari:maven:wrapper -Dmaven=3.5.4-->
      <plugin>
        <groupId>io.takari</groupId>
        <artifactId>maven</artifactId>
        <version>0.6.1</version>
      </plugin>

      <!-- Language-level aside, make sure Java 9 types and methods aren't used -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <version>1.17</version>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>${main.signature.artifact}</artifactId>
            <version>1.0</version>
          </signature>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Ensures checksums are added to published jars -->
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>${maven-install-plugin.version}</version>
        <configuration>
          <createChecksum>true</createChecksum>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>${maven-deploy-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>${maven-release-plugin.version}</version>
        <configuration>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <!-- to match zipkin-scala (openzipkin/zipkin) -->
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.2</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license-maven-plugin.version}</version>
        <configuration>
          <header>${main.basedir}/src/etc/header.txt</header>
          <mapping>
            <!-- Don't use javadoc style as this makes code formatters break it by adding tags! -->
            <java>SLASHSTAR_STYLE</java>
          </mapping>
          <excludes>
            <exclude>.travis.yml</exclude>
            <exclude>.gitignore</exclude>
            <exclude>.mvn/**</exclude>
            <exclude>mvnw*</exclude>
            <exclude>etc/header.txt</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>codecov.yml</exclude>
            <exclude>LICENSE</exclude>
            <exclude>**/*.md</exclude>
            <exclude>src/test/resources/**</exclude>
            <exclude>src/main/resources/**</exclude>
          </excludes>
          <strictCheck>true</strictCheck>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin-git</artifactId>
            <version>${license-maven-plugin.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>io.zipkin.centralsync-maven-plugin</groupId>
        <artifactId>centralsync-maven-plugin</artifactId>
        <version>0.1.0</version>
        <configuration>
          <subject>openzipkin-contrib</subject>
          <repo>maven</repo>
          <packageName>brave-ratpack</packageName>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Creates source jar -->
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Creates javadoc jar -->
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <configuration>
              <failOnError>false</failOnError>
              <!-- hush pedantic warnings: we don't put param and return on everything! -->
              <doclint>none</doclint>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
