<?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>

  <parent>
    <groupId>com.google.cloud.bigtable</groupId>
    <artifactId>bigtable-client-core-parent</artifactId>
    <version>2.20.1</version> <!-- {x-version-update:bigtable-client-parent:current} -->
  </parent>

  <artifactId>bigtable-hbase</artifactId>
  <packaging>jar</packaging>
  <name>${project.groupId}:${project.artifactId}</name>
  <description>
    This project contains artifacts that adapt bigtable client to work with
    hbase.
  </description>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-bigtable-bom</artifactId>
        <version>${bigtable.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-bigtable-deps-bom</artifactId>
        <version>${bigtable.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Api/HBase deps first -->
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-shaded-client</artifactId>
      <version>${hbase1.version}</version>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>ch.qos.reload4j</groupId>
      <artifactId>reload4j</artifactId>
      <version>${reload4j.version}</version>
    </dependency>

    <!-- Implementation deps -->
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-bigtable</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>bigtable-metrics-api</artifactId>
      <version>${bigtable-metrics-api.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>com.google.cloud.bigtable</groupId>
      <artifactId>bigtable-internal-test-helper</artifactId>
      <version>2.20.1</version> <!-- {x-version-update:bigtable-client-parent:current} -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>grpc-google-common-protos</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>grpc-google-cloud-bigtable-admin-v2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>${commons-lang.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.truth</groupId>
      <artifactId>truth</artifactId>
      <version>${truth.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.checkerframework</groupId>
          <artifactId>checker-qual</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <trimStackTrace>false</trimStackTrace>
          <!-- Drop jspecify from the TEST runtime classpath only (it stays on the
               compile classpath, so downstream modules and shaded jars are
               unaffected). Since google-cloud-bigtable 2.81.0 (gax 2.83.0) the
               veneer API is annotated with @org.jspecify.annotations.NullMarked,
               whose @Target references ElementType.MODULE (Java 9+). When
               Mockito/byte-buddy mocks an annotated veneer type (e.g. Batcher) on
               Java 8, the JDK parses that @Target, cannot find the MODULE constant,
               and throws ArrayStoreException: EnumConstantNotPresentExceptionProxy
               ("Mockito cannot mock this class"). jspecify carries no runtime
               behavior, so removing it from the test classpath makes the JVM
               silently ignore @NullMarked and the mocks succeed. -->
          <classpathDependencyExcludes>
            <classpathDependencyExclude>org.jspecify:jspecify</classpathDependencyExclude>
          </classpathDependencyExcludes>
          <systemProperties>
            <property>
              <name>java.util.logging.config.file</name>
              <value>src/test/resources/logging.properties</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.google.cloud.bigtable.test</groupId>
        <artifactId>bigtable-build-helper</artifactId>
        <version>2.20.1</version> <!-- {x-version-update:bigtable-client-parent:current} -->

        <executions>
          <execution>
            <id>verify-mirror-deps-cbt</id>
            <phase>verify</phase>
            <goals>
              <goal>verify-mirror-deps</goal>
            </goals>
            <configuration>
              <targetDependencies>
                <!-- make sure that we are a strict superset of veneer -->
                <targetDependency>com.google.cloud:google-cloud-bigtable</targetDependency>
              </targetDependencies>
            </configuration>
          </execution>
          <execution>
            <id>verify-mirror-deps-hbase</id>
            <phase>verify</phase>
            <goals>
              <goal>verify-mirror-deps</goal>
            </goals>
            <configuration>
              <targetDependencies>
                <!-- make sure that we are a strict superset of hbase -->
                <targetDependency>org.apache.hbase:hbase-shaded-client</targetDependency>
              </targetDependencies>
              <ignoredDependencies>
                <!-- forcefully replaced with reload4j -->
                <!-- veneer requires slf4j-api 2.x while hbase ships 1.7.x -->
                <dependency>org.slf4j:slf4j-api</dependency>
                <dependency>log4j:log4j</dependency>
              </ignoredDependencies>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
