<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) 2022 Google, Inc.

  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.hive</groupId>
    <artifactId>hive-bigquery-parent</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging>
    <name>Hive BigQuery Connector Build Parent</name>
    <description>Parent project for all the Hive BigQuery Connector artifacts
    </description>

    <url>https://github.com/GoogleCloudDataproc/hive-bigquery-connector</url>

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

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

    <scm>
        <connection>
            scm:git:git@github.com:GoogleCloudDataproc/hive-bigquery-connector.git
        </connection>
        <developerConnection>
            scm:git:git@github.com:GoogleCloudDataproc/hive-bigquery-connector.git
        </developerConnection>
        <url>git@github.com:GoogleCloudDataproc/hive-bigquery-connector.git</url>
    </scm>

    <properties>
        <revision>2.0.0-SNAPSHOT</revision>
        <nexus.remote.skip>false</nexus.remote.skip>

        <avro.version>1.11.1</avro.version>
        <jackson.version>2.12.7.1</jackson.version>
        <protobuf.version>3.21.12</protobuf.version>
        <legacy-bigquery-connector.version>hadoop2-1.0.0</legacy-bigquery-connector.version>
        <bigquery-connector-common.version>0.31.0</bigquery-connector-common.version>
        <google-cloud-dataproc.version>4.7.0</google-cloud-dataproc.version>
        <google-cloud-storage.version>2.20.1</google-cloud-storage.version>
        <grpc.version>1.53.0</grpc.version>
        <junit.version>5.9.2</junit.version>
        <hamcrest.version>2.2</hamcrest.version>
        <hiverunner.version>6.1.0</hiverunner.version>
        <truth.version>1.1.3</truth.version>

        <maven-spotless-plugin.version>2.14.0</maven-spotless-plugin.version>
        <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
        <maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version>
        <maven-exec-plugin.version>3.1.0</maven-exec-plugin.version>
        <maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M8</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.0.0-M8</maven-failsafe-plugin.version>
        <build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>

        <java.version>1.8</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

        <compiler.error.flag>-Werror</compiler.error.flag>
        <compiler.default.pkginfo.flag>-Xpkginfo:always</compiler.default.pkginfo.flag>
        <compiler.default.exclude>nothing</compiler.default.exclude>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.36</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.conscrypt</groupId>
            <artifactId>conscrypt-openjdk-uber</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>google-cloud-storage-bom</artifactId>
                <version>${google-cloud-storage.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.cloud.spark</groupId>
                <artifactId>bigquery-connector-common</artifactId>
                <version>${bigquery-connector-common.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-bom</artifactId>
                <version>${protobuf.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.lmax</groupId>
                <artifactId>disruptor</artifactId>
                <version>3.4.2</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-bom</artifactId>
                <version>${grpc.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>javax.el</artifactId>
                <version>3.0.0</version>
            </dependency>
        </dependencies>

    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${maven-spotless-plugin.version}</version>
                <configuration>
                    <formats>
                        <format>
                            <includes>
                                <include>*.java</include>
                                <include>*.md</include>
                                <include>*.xml</include>
                            </includes>
                            <trimTrailingWhitespace/>
                            <endWithNewline/>
                        </format>
                    </formats>
                    <java>
                        <googleJavaFormat>
                            <version>1.7</version>
                            <style>GOOGLE</style>
                            <!--<reflowLongStrings>true</reflowLongStrings>-->
                        </googleJavaFormat>

                        <licenseHeader>
                            <content>/*
 * Copyright $YEAR 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.
 */
                            </content>
                        </licenseHeader>
                    </java>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>integration</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.0.0-M6</version>
                        <configuration>
                            <forkCount>1</forkCount>
                            <reuseForks>false</reuseForks>
                            <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
                            <includes>
                                <include>**/*IntegrationTests.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>verify</id>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>acceptance</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-failsafe-plugin.version}</version>
                        <configuration>
                            <forkCount>1</forkCount>
                            <reuseForks>false</reuseForks>
                            <includes>
                                <include>**/*AcceptanceTest.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>verify</id>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <gpg.skip>false</gpg.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                            <skipRemoteStaging>${nexus.remote.skip}</skipRemoteStaging>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- Expect the password to be passed as the gpg.passphrase property instead of provided over a tty by the gpg-agent process. -->
                            <useAgent>false</useAgent>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
          <id>oss-hadoop2</id>
          <properties>
            <hadoop.version>2.10.2</hadoop.version>
            <hive.version>3.1.2</hive.version>
            <tez.version>0.9.2</tez.version>
            <gcs-connector.version>hadoop2-2.2.11</gcs-connector.version>
          </properties>
        </profile>
        <profile>
          <id>dataproc20</id>
          <properties>
            <hadoop.version>3.2.3</hadoop.version>
            <hive.version>3.1.2</hive.version>
            <tez.version>0.9.2-SNAPSHOT</tez.version> <!-- Must be built and installed from source using Tez's "branch-0.9" in anticipation for the 0.9.3 release -->
            <gcs-connector.version>hadoop3-2.2.11</gcs-connector.version>
          </properties>
        </profile>
        <profile>
          <id>dataproc21</id>
          <activation>
            <activeByDefault>true</activeByDefault>
          </activation>
          <properties>
            <hadoop.version>3.3.3</hadoop.version>
            <hive.version>3.1.3</hive.version>
            <tez.version>0.10.1</tez.version>
            <gcs-connector.version>hadoop3-2.2.9</gcs-connector.version>
          </properties>
        </profile>
    </profiles>

</project>
