<!--
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.11.0</version>
    </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>
        <dependency>
            <groupId>org.apache.beam</groupId>
            <artifactId>beam-sdks-java-core</artifactId>
            <version>${beam.version}</version>
        </dependency>
        <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>${project.version}</version>
            <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>
            </exclusions>

        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.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>org.hamcrest</groupId>
          <artifactId>hamcrest-library</artifactId>
          <version>${hamcrest.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>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>${commons-lang.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>
        <profile>
            <id>release</id>
            <build>
                <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 ${project.version} 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>
           </build>
        </profile>
    </profiles>
    <build>
        <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>
                <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>
        </plugins>
    </build>
</project>
