<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 Google LLC

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>com.google.cloud.bigtable</groupId>
  <artifactId>bigtable-client-parent</artifactId>
  <version>2.14.2</version> <!-- {x-version-update:bigtable-client-parent:current} -->
  <packaging>pom</packaging>
  <name>${project.groupId}:${project.artifactId}</name>
  <url>https://cloud.google.com/bigtable/</url>
  <description>
    This is a client to access Cloud Bigtable
    (https://cloud.google.com/bigtable/) via the HBase APIs.
  </description>
  <!-- TODO: improve the description -->

  <parent>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-shared-config</artifactId>
    <version>1.7.7</version>
  </parent>

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

  <modules>
    <module>bigtable-client-core-parent</module>
    <module>bigtable-hbase-1.x-parent</module>
    <module>bigtable-hbase-2.x-parent</module>
    <module>bigtable-dataflow-parent</module>
    <module>bigtable-test</module>
    <module>hbase-migration-tools</module>
  </modules>

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

    <!-- core dependency versions -->
    <bigtable.version>2.39.2</bigtable.version>
    <google-cloud-bigtable-emulator.version>0.175.0</google-cloud-bigtable-emulator.version>
    <bigtable-metrics-api.version>1.29.2</bigtable-metrics-api.version>
    <!-- Optional dep for bigtable-metrics-api used for tests -->
    <dropwizard-metrics.version>4.2.22</dropwizard-metrics.version>

    <!--  keeping at this version to align with hbase-->
    <reload4j.version>1.2.24</reload4j.version>

    <!-- hbase dependency versions -->
    <hbase1.version>1.7.2</hbase1.version>
    <hbase2.version>2.5.7-hadoop3</hbase2.version>
    <hbase2-testing-util-mockito.version>2.28.2</hbase2-testing-util-mockito.version>

    <!-- bytebuddy dependency version for resolving hbase backward incompatible changes -->
    <byte.buddy.version>1.14.10</byte.buddy.version>

    <license-maven-plugin.version>2.3.0</license-maven-plugin.version>
    <!-- testing dependency versions -->
    <commons-lang.version>2.6</commons-lang.version>
    <junit.version>4.13.2</junit.version>
    <junit-vintage-engine.version>5.9.2</junit-vintage-engine.version>
    <truth.version>1.1.5</truth.version>
    <hamcrest.version>1.3</hamcrest.version>
    <mockito.version>4.11.0</mockito.version>
    <beam.version>2.55.1</beam.version>
    <!-- referred from bigtable-beam-import and bigtable-emulator -->
    <guava.version>31.1-jre</guava.version>
    <opencensus.version>0.31.1</opencensus.version>

    <!-- Enable the ability to skip unit tests and only run integration tests,
         while still respecting global skipTests override. -->
    <skipTests>false</skipTests>
    <skipUnitTests>${skipTests}</skipUnitTests>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <scm>
    <connection>
      scm:git:git@github.com:googleapis/java-bigtable-hbase.git
    </connection>
    <developerConnection>
      scm:git:git@github.com:googleapis/java-bigtable-hbase.git
    </developerConnection>
    <url>https://github.com/googleapis/java-bigtable-hbase</url>
    <tag>HEAD</tag>
  </scm>

  <developers>
    <developer>
      <organization>Google</organization>
      <organizationUrl>http://www.google.com</organizationUrl>
    </developer>
  </developers>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/googleapis/java-bigtable-hbase/issues</url>
  </issueManagement>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <!-- enable system property substitution. -->
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
        </plugin>

        <!-- Disable google-cloud-shared-config's enforcement of enumerating transitive deps.
          This project predominantly lives in the HBase classpath, and trying to mirror the
          classpath is extremely difficult without much benefit.
         -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <configuration>
            <ignoredDependencies>
              <dependency>*</dependency>
            </ignoredDependencies>
          </configuration>
        </plugin>
        <!-- Disable google-cloud-shared-config's clirr checks. This project simply implements
        HBase apis, so tracking removal of apis doesnt make sense. -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>clirr-maven-plugin</artifactId>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
            <!-- enable the ability to skip unit tests, while running integration tests -->
            <skipTests>${skipUnitTests}</skipTests>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <!-- MSHADE-419: 3.3.0 Shade plugin causes pom to be created without compile dependencies -->
          <version>3.2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <doclint>none</doclint>
            <windowtitle>
              Cloud Bigtable HBase Client for Java API
            </windowtitle>
            <doctitle>
              Cloud Bigtable HBase Client for Java API
            </doctitle>
            <overview>../overview.html</overview>
            <bottom><![CDATA[<br>]]></bottom>

            <offlineLinks>
              <offlineLink>
                <url>
                  https://google.github.io/guava/releases/27.0-jre/api/docs/
                </url>
                <location>${basedir}/javadoc/guava-docs</location>
              </offlineLink>
              <offlineLink>
                <url>https://hbase.apache.org/2.0/devapidocs/</url>
                <location>${basedir}/javadoc/hbase-docs</location>
              </offlineLink>
              <offlineLink>
                <url>
                  https://static.javadoc.io/com.google.protobuf/protobuf-java/3.6.1/
                </url>
                <location>${basedir}/javadoc/protobuf-docs</location>
              </offlineLink>
            </offlineLinks>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <phase>package</phase>
              <configuration>
                <!--
                javadoc excluded packages:
                    com.google.clooud.*                             (Ignore, a hack/workaround for separate maven issue)
                -->
                <excludePackageNames>com.google.clooud</excludePackageNames>
              </configuration>
            </execution>
            <execution>
              <id>default-cli</id>
              <configuration>
                <!--
                javadoc excluded packages:
                    com.google.cloud.bigtable.beam{.sequencefiles}  (Breaks with javadoc:aggregate, handled separately)
                    com.google.cloud.bigtable.dataflow{import,}     (Breaks with javadoc:aggregate, handled separately)
                    com.google.clooud.*                             (Ignore, a hack/workaround for separate maven issue)
                -->
                <excludePackageNames>
                  com.google.cloud.bigtable.beam:com.google.cloud.bigtable.beam.sequencefiles:com.google.cloud.bigtable.dataflow:com.google.cloud.bigtable.dataflowimport:com.google.clooud
                </excludePackageNames>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <!-- All hbase deps are provided and we have no hope of enforcing rules on them -->
                <banDuplicateClasses>
                  <scopes combine.children="override">
                    <scope>compile</scope>
                  </scopes>
                </banDuplicateClasses>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-banned-deps</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <includes>
                    <include>*:*:*:*:provided</include>
                    <include>*:*:*:*:test</include>
                  </includes>
                  <excludes>
                    <!-- ban all log4j 2.x deps with CVEs -->
                    <exclude>org.apache.logging.log4j:*:[2.0-alpha1,2.16.0]</exclude>
                    <!-- ban all log4j -->
                    <exclude>log4j:log4j:*</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>useBigtableSnapshots</id>
      <!-- use the snapshot veneer artifact to run the tests-->
      <properties>
        <bigtable.version>LATEST</bigtable.version>
      </properties>

      <repositories>
        <repository>
          <id>sonatype-snapshots</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</project>
