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

    Copyright 2016-2020 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.aws</groupId>
  <artifactId>zipkin-aws-parent</artifactId>
  <version>0.21.3</version>
  <packaging>pom</packaging>

  <modules>
    <module>sender-sqs</module>
    <module>sender-awssdk-sqs</module>
    <module>collector-sqs</module>
    <module>aws-junit</module>
    <module>module</module>
    <module>collector-kinesis</module>
    <module>sender-kinesis</module>
    <module>storage-xray-udp</module>
    <module>reporter-xray-udp</module>
    <module>brave-instrumentation</module>
    <module>brave-propagation-aws</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>

    <!-- default bytecode version for src/main -->
    <main.java.version>1.6</main.java.version>
    <main.signature.artifact>java16</main.signature.artifact>

    <main.basedir>${project.basedir}</main.basedir>

    <!-- TODO: cleanup any redundant ignores now also in the 4.0 release (once final) -->
    <license-maven-plugin.version>4.0.rc2</license-maven-plugin.version>

    <!-- matching armeria/zipkin -->
    <spring-boot.version>2.3.3.RELEASE</spring-boot.version>
    <jackson.version>2.10.3</jackson.version>
    <!-- This allows you to test feature branches with jitpack -->
    <armeria.groupId>com.linecorp.armeria</armeria.groupId>
    <armeria.version>0.99.9</armeria.version>
    <!-- Match Armeria version to avoid conflicts including running tests in the IDE -->
    <netty.version>4.1.51.Final</netty.version>

    <!-- It's easy for Jackson dependencies to get misaligned, so we manage it ourselves. -->
    <jackson.version>2.11.2</jackson.version>

    <zipkin.version>2.21.7</zipkin.version>
    <zipkin-reporter.version>2.15.1</zipkin-reporter.version>
    <brave.version>5.12.5</brave.version>

    <slf4j.version>1.7.30</slf4j.version>
    <log4j.version>2.13.3</log4j.version>

    <aws-java-sdk.version>1.11.846</aws-java-sdk.version>
    <sdk-core.version>2.14.2</sdk-core.version>

    <mockito.version>3.4.6</mockito.version>

    <!-- override to set exclusions per-project -->
    <errorprone.args />
    <errorprone.version>2.4.0</errorprone.version>

    <maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
  </properties>

  <name>Zipkin AWS (Parent)</name>
  <description>Zipkin AWS (Parent)</description>
  <url>https://github.com/openzipkin/zipkin-aws</url>
  <inceptionYear>2016</inceptionYear>

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

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

  <scm>
    <url>https://github.com/openzipkin/zipkin-aws</url>
    <connection>scm:git:https://github.com/openzipkin/zipkin-aws.git</connection>
    <developerConnection>scm:git:https://github.com/openzipkin/zipkin-aws.git</developerConnection>
    <tag>0.21.3</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>
      <url>https://api.bintray.com/maven/openzipkin/maven/zipkin-aws/;publish=1</url>
    </repository>
    <snapshotRepository>
      <id>jfrog-snapshots</id>
      <url>https://oss.jfrog.org/artifactory/oss-snapshot-local</url>
    </snapshotRepository>
  </distributionManagement>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/openzipkin/zipkin-aws/issues</url>
  </issueManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>${jackson.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-bom</artifactId>
        <version>${netty.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>io.zipkin.zipkin2</groupId>
        <artifactId>zipkin</artifactId>
        <version>${zipkin.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zipkin.zipkin2</groupId>
        <artifactId>zipkin-collector</artifactId>
        <version>${zipkin.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zipkin.zipkin2</groupId>
        <artifactId>zipkin-tests</artifactId>
        <version>${zipkin.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>io.zipkin.reporter2</groupId>
        <artifactId>zipkin-reporter</artifactId>
        <version>${zipkin-reporter.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>zipkin-storage-xray-udp</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
      </dependency>
      <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>4.0.3</version>
      </dependency>
      <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>mockwebserver</artifactId>
        <version>4.8.1</version>
      </dependency>
      <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-bom</artifactId>
        <version>${aws-java-sdk.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>sqs</artifactId>
        <version>${sdk-core.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.16.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.2.3</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <!-- mvn -N io.takari:maven:wrapper generates the ./mvnw script -->
        <plugin>
          <groupId>io.takari</groupId>
          <artifactId>maven</artifactId>
          <version>0.7.7</version>
          <configuration>
            <maven>3.6.3</maven>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <inherited>true</inherited>
          <configuration>
            <!-- Retrolambda will rewrite lambdas as Java 6 bytecode -->
            <source>1.8</source>
            <target>1.8</target>
            <!-- or die! com.sun.tools.javac.api.JavacTool -->
            <fork>true</fork>
            <showWarnings>true</showWarnings>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${spring-boot.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <layoutFactory implementation="zipkin.layout.ZipkinLayoutFactory">
              <name>zipkin</name>
            </layoutFactory>
            <classifier>module</classifier>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>io.zipkin.layout</groupId>
              <artifactId>zipkin-layout-factory</artifactId>
              <version>0.0.5</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>animal-sniffer-maven-plugin</artifactId>
          <version>1.19</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>net.orfjackal.retrolambda</groupId>
        <artifactId>retrolambda-maven-plugin</artifactId>
        <version>2.5.7</version>
        <executions>
          <execution>
            <goals>
              <goal>process-main</goal>
            </goals>
            <configuration>
              <target>${main.java.version}</target>
              <fork>true</fork>
              <quiet>true</quiet>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-failsafe-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-failsafe-plugin.version}</version>
        <!-- Try to prevent flakes in circleci -->
        <configuration>
          <reuseForks>false</reuseForks>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>${main.signature.artifact}</artifactId>
            <version>1.0</version>
          </signature>
          <checkTestClasses>false</checkTestClasses>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>3.0.0-M1</version>
      </plugin>

      <!-- Uploads occur as a last step (which also adds checksums) -->
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>3.0.0-M1</version>
      </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>
            <kt>SLASHSTAR_STYLE</kt>
            <bnd>SCRIPT_STYLE</bnd>
            <Dockerfile.release>SCRIPT_STYLE</Dockerfile.release>
            <post_push>SCRIPT_STYLE</post_push>
            <build>SCRIPT_STYLE</build>
          </mapping>
          <excludes>
            <exclude>**/log4j2.properties</exclude>
            <exclude>.travis.yml</exclude>
            <exclude>**/*.dockerignore</exclude>
            <exclude>.editorconfig</exclude>
            <exclude>.gitattributes</exclude>
            <exclude>.gitignore</exclude>
            <exclude>.github/**</exclude>
            <exclude>.mvn/**</exclude>
            <exclude>mvnw*</exclude>
            <exclude>etc/header.txt</exclude>
            <exclude>docker/**/*_profile</exclude>
            <exclude>hooks/**</exclude>
            <exclude>**/nginx.conf</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>**/.editorconfig</exclude>
            <exclude>LICENSE</exclude>&gt;
            <exclude>**/*.md</exclude>
            <exclude>**/*.bnd</exclude>
            <exclude>**/src/main/resources/zipkin.txt</exclude>
            <exclude>**/src/main/resources/*.yml</exclude>
            <exclude>**/spring.factories</exclude>
            <exclude>src/test/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>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[11,15)</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M1</version>
        <configuration>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.zipkin.centralsync-maven-plugin</groupId>
        <artifactId>centralsync-maven-plugin</artifactId>
        <version>0.1.1</version>
        <configuration>
          <packageName>zipkin-aws</packageName>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>error-prone-9+</id>
      <activation>
        <jdk>[9,)</jdk>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <!-- only use errorprone on main source tree -->
                <id>default-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <forceJavacCompilerUse>true</forceJavacCompilerUse>
                  <compilerArgs>
                    <arg>-XDcompilePolicy=simple</arg>
                    <arg>-Xplugin:ErrorProne ${errorprone.args}</arg>
                  </compilerArgs>
                  <annotationProcessorPaths>
                    <processorPath>
                      <groupId>com.google.errorprone</groupId>
                      <artifactId>error_prone_core</artifactId>
                      <version>${errorprone.version}</version>
                    </processorPath>
                  </annotationProcessorPaths>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- Creates source jar -->
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.2.0</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>
    <profile>
      <id>sonatype</id>
      <distributionManagement>
        <repository>
          <id>sonatype</id>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
      </distributionManagement>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-release-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
