<!--
Copyright 2017 Google Inc. All Rights Reserved.
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-dataflow-parent</artifactId>
    <version>1.27.1</version> <!-- {x-version-update:bigtable-client-parent:current} -->
  </parent>

  <artifactId>bigtable-hbase-beam</artifactId>
  <packaging>jar</packaging>
  <name>${project.groupId}:${project.artifactId}</name>
  <description>
    This project contains artifacts that provide Cloud Bigtable client readers
    and writers in Google Cloud Dataflow.
  </description>

  <dependencies>
    <!-- to use HBaseCoderProviderRegistrar-->
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-io-hbase</artifactId>
      <version>${beam.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>bigtable-hbase-1.x-shaded</artifactId>
      <version>1.27.1</version> <!-- {x-version-update:bigtable-client-parent:current} -->
      <exclusions>
        <!-- Workaround MNG-5899 & MSHADE-206. Maven >= 3.3.0 doesn't use the dependency reduced
        pom.xml files when invoking the build from a parent project. So we have to manually exclude
        the dependencies. Note that this works in conjunction with the manually promoted dependencies
        in bigtable-hbase-1.x-shaded/pom.xml -->
        <exclusion>
          <groupId>${project.groupId}</groupId>
          <artifactId>bigtable-hbase-1.x</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.opencensus</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.grpc</groupId>
          <artifactId>grpc-census</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-core</artifactId>
      <version>${beam.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-shaded-client</artifactId>
      <version>${hbase.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>${jsr305.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <!--  TODO: remove this dependency when upgraded through transitive dependency (beam-sdks-java-core)
     this is not used directly, but upgrading due to transitive vulnerabilities in older versions-->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.21</version>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>${log4j2.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <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.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <profiles>
    <profile>
      <id>bigtableDataflowIntegrationTest</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>api-integration-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <phase>none</phase>
              </execution>
              <execution>
                <id>api-gap-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <phase>integration-test</phase>
                <configuration>
                  <!-- to enable netty logging, include:
                  -Djava.util.logging.config.file=src/test/resources/logging.properties
                  -->
                  <forkCount>1</forkCount>
                  <includes>
                    <include>**/CloudBigtableIOIntegrationTest.java</include>
                  </includes>
                  <reportNameSuffix>bigtable-server</reportNameSuffix>
                  <systemPropertyVariables>
                    <bigtable.test.extra.resources>
                      bigtable-test.xml
                    </bigtable.test.extra.resources>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <windowtitle>
              Apache Beam + Cloud Bigtable Connector ${project.version} API
            </windowtitle>
            <doctitle>
              Apache Beam + Cloud Bigtable Connector API
            </doctitle>
            <overview>../overview.html</overview>
            <bottom><![CDATA[<br>]]></bottom>

            <offlineLinks>
              <offlineLink>
                <url>
                  https://beam.apache.org/releases/javadoc/${beam.version}/
                </url>
                <location>${basedir}/javadoc/beam-docs</location>
              </offlineLink>
              <offlineLink>
                <url>https://hbase.apache.org/2.0/apidocs/</url>
                <location>${basedir}/javadoc/hbase-docs</location>
              </offlineLink>
            </offlineLinks>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>jar</goal>
              </goals>
              <phase>package</phase>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
          <useProjectReferences>false</useProjectReferences>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>**/*IntegrationTest.java</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <!-- commons-compress is not used directly, but upgrading due to transitive vulnerabilities in older versions-->
          <!-- beam-sdks-java-io-hbase is to use HBaseCoderProviderRegistrar-->
          <usedDependencies>
            <usedDependency>org.apache.commons:commons-compress</usedDependency>
            <usedDependency>
              org.apache.beam:beam-sdks-java-io-hbase
            </usedDependency>
          </usedDependencies>
          <ignoredUnusedDeclaredDependencies>
            <!-- log4j-api dependency is added to enforce log4j versions with CVE fixes -->
            <ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-api</ignoredUnusedDeclaredDependency>
          </ignoredUnusedDeclaredDependencies>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
