<!--
Copyright 2015 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-client</artifactId>
        <version>0.3.0</version>
    </parent>

    <groupId>com.google.cloud.bigtable</groupId>
    <artifactId>bigtable-dataflow-import</artifactId>
    <packaging>jar</packaging>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>
       This project contains artifacts that import HBase Sequence Files into Google Cloud Bigtable using Google Cloud Dataflow.
    </description>

    <properties>
        <gcsconnector.version>1.4.3-hadoop2</gcsconnector.version>
        <!-- A guava version that is compatible with both gcs-connector and hadoop2. This overrides
            guava version specification in parent project. -->
        <guava.version>15.0</guava.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.cloud.bigtable</groupId>
            <artifactId>bigtable-hbase-dataflow</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <!-- Keeping guava dependency here so that third party code using this package
                 does not have to declare it-->
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <!-- hbase-server jar provides Deserializer for the Result class. It also pulls in
                 necessary hadoop jars. -->
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-server</artifactId>
            <version>${hbase.version}</version>
        </dependency>
        <dependency>
            <!-- For accessing gs buckets from the hadoop SequenceFile reader. -->
            <groupId>com.google.cloud.bigdataoss</groupId>
            <artifactId>gcs-connector</artifactId>
            <version>${gcsconnector.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>sequencefileIntegrationTest</id>
            <dependencies>
                <dependency>
                    <groupId>org.mortbay.jetty.alpn</groupId>
                    <artifactId>alpn-boot</artifactId>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>import-e2e-test</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <!-- ALPN is needed for SSL engine rewrites -->
                                    <!-- to enable netty logging, include:
                                    -Djava.util.logging.config.file=src/test/resources/logging.properties
                                    -->
                                    <argLine>
                                        -Xbootclasspath/p:${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn.version}/alpn-boot-${alpn.version}.jar
                                    </argLine>
                                    <forkCount>1</forkCount>
                                    <includes>
                                        <include>**/*IntegrationTest.java</include>
                                    </includes>
                                    <!-- Use Isolated Classloader so that dataflow can find all files
                                         that must be staged.
                                    -->
                                    <useSystemClassLoader>false</useSystemClassLoader>
                                    <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>Google Cloud Dataflow + Cloud Bigtable Connector ${project.version} API</windowtitle>
                            <doctitle>Google Cloud Dataflow + Cloud Bigtable Connector ${project.version} API</doctitle>
                            <overview>../overview.html</overview>
                            <bottom><![CDATA[<br>]]></bottom>

                            <offlineLinks>
                                <offlineLink>
                                    <url>https://cloud.google.com/dataflow/java-sdk/JavaDoc/</url>
                                    <location>${basedir}/javadoc/dataflow-docs</location>
                                </offlineLink>
                                <offlineLink>
                                    <url>https://hbase.apache.org/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>
                <version>2.9</version>
                <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>
