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

    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>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>21</version>
  </parent>

  <groupId>org.apache.zipkin.brave.cassandra</groupId>
  <artifactId>brave-cassandra-parent</artifactId>
  <version>0.10.2</version>
  <packaging>pom</packaging>

  <modules>
    <module>cassandra</module>
    <module>cassandra-driver</module>
    <module>cassandra-tests</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.7</main.java.version>
    <main.signature.artifact>java17</main.signature.artifact>

    <main.basedir>${project.basedir}</main.basedir>
    <brave.version>5.6.3</brave.version>

    <log4j.version>2.11.2</log4j.version>

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

    <license-maven-plugin.version>3.0</license-maven-plugin.version>
    <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
  </properties>

  <name>Brave Cassandra (Parent)</name>
  <description>Apache Zipkin Brave (incubating) for Apache Cassandra (Parent)</description>
  <url>https://github.com/apache/incubator-zipkin-brave-cassandra</url>
  <inceptionYear>2017</inceptionYear>

  <organization>
    <name>The Apache Software Foundation</name>
    <url>http://www.apache.org/</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/apache/incubator-zipkin-brave-cassandra</url>
    <connection>scm:git:https://github.com/apache/incubator-zipkin-brave-cassandra.git</connection>
    <developerConnection>scm:git:https://github.com/apache/incubator-zipkin-brave-cassandra.git</developerConnection>
    <tag>v0.10.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>

  <mailingLists>
    <mailingList>
      <name>Zipkin Developer List</name>
      <post>dev@zipkin.apache.org</post>
      <subscribe>dev-subscribe@zipkin.apache.org</subscribe>
      <unsubscribe>dev-unsubscribe@zipkin.apache.org</unsubscribe>
    </mailingList>
    <mailingList>
      <name>Zipkin Commits</name>
      <post>commits@zipkin.apache.org</post>
      <subscribe>commits-subscribe@zipkin.apache.org</subscribe>
      <unsubscribe>commits-unsubscribe@zipkin.apache.org</unsubscribe>
    </mailingList>
  </mailingLists>

  <distributionManagement>
    <repository>
      <id>apache.releases.https</id>
      <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>apache.snapshots.https</id>
      <url>https://repository.apache.org/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/apache/incubator-zipkin-brave-cassandra/issues</url>
  </issueManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.zipkin.brave</groupId>
        <artifactId>brave-bom</artifactId>
        <version>${brave.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-all</artifactId>
        <version>3.11.4</version>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>*</artifactId>
          </exclusion>
          <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <!-- Override until Cassandra 4.0 per CASSANDRA-9608 -->
      <dependency>
        <groupId>com.github.jbellis</groupId>
        <artifactId>jamm</artifactId>
        <version>0.3.3</version>
      </dependency>
      <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-core</artifactId>
        <version>3.7.1</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.12.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>io.zipkin.brave</groupId>
      <artifactId>brave</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <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.4</version>
          <configuration>
            <maven>3.6.0</maven>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <!-- inherit version from org.apache:parent -->
          <configuration>
            <failOnError>false</failOnError>
            <!-- hush pedantic warnings: we don't put param and return on everything! -->
            <doclint>none</doclint>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <inherited>true</inherited>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <!-- Retrolambda will rewrite lambdas as Java 6 bytecode -->
          <source>1.8</source>
          <target>1.8</target>
          <forceJavacCompilerUse>true</forceJavacCompilerUse>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>

      <plugin>
        <groupId>net.orfjackal.retrolambda</groupId>
        <artifactId>retrolambda-maven-plugin</artifactId>
        <version>2.5.6</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.1.1</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>
        <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>
        <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>

      <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>
          </mapping>
          <excludes>
            <exclude>.travis.yml</exclude>
            <exclude>.gitignore</exclude>
            <exclude>.mvn/**</exclude>
            <exclude>mvnw*</exclude>
            <exclude>etc/header.txt</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>LICENSE</exclude>
            <exclude>DISCLAIMER</exclude>
            <exclude>NOTICE</exclude>
            <exclude>Jenkinsfile</exclude>
            <exclude>**/*.md</exclude>
          </excludes>
          <strictCheck>true</strictCheck>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M2</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[11,12)</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.13</version>
        <configuration>
          <excludes>
            <exclude>**/target/**</exclude>

            <!-- IDE files -->
            <exclude>**/*.iml</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>**/*.classpath</exclude>
            <exclude>**/.project</exclude>
            <exclude>**/.settings/**</exclude>
            <exclude>**/dependency-reduced-pom.xml</exclude>

            <!-- git files -->
            <exclude>**/.gitignore</exclude>
            <exclude>**/.gitmodules</exclude>
            <exclude>**/.git/**</exclude>

            <!-- CI files -->
            <exclude>**/.travis.yml</exclude>

            <!-- GitHub files -->
            <exclude>**/.github/**</exclude>

            <!-- document files -->
            <exclude>**/*.md</exclude>

            <!-- Maven Wrapper generated files -->
            <exclude>.mvn/wrapper/maven-wrapper.properties</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- org.apache:apache:21 sets maven-remote-resources-plugin in plugins, not pluginManagement
           This results in execution in the parent project, and a side effect of an empty
           DEPENDENCIES file in the assembly when packaged with the apache-release profile.

           https://issues.apache.org/jira/browse/MPOM-218

           This works around the problem by skipping at the parent level at the cost of having to
           un-skip it at every deployed child.
       -->
      <plugin>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>error-prone-11+</id>
      <activation>
        <jdk>[11,)</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>apache-release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>source-release-assembly</id>
                <configuration>
                  <!-- make the source release zip includes the word incubating -->
                  <finalName>apache-zipkin-brave-cassandra-incubating-${project.version}</finalName>
                  <descriptors>
                    <descriptor>src/main/assemblies/source-release.xml</descriptor>
                  </descriptors>
                  <!-- don't inherit the source-release as we are overriding it -->
                  <descriptorRefs combine.self="override" />
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
