<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) 2014 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <name>BigDataOSS Parent</name>
  <description>
    Parent project for Google Cloud Platform Big-Data connectors.
  </description>

  <groupId>com.google.cloud.bigdataoss</groupId>
  <artifactId>bigdataoss-parent</artifactId>
  <version>2.2.22</version>
  <packaging>pom</packaging>

  <url>https://github.com/GoogleCloudDataproc/hadoop-connectors</url>

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

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

  <scm>
    <connection>scm:git:git@github.com:GoogleCloudDataproc/hadoop-connectors.git</connection>
    <developerConnection>
      scm:git:git@github.com:GoogleCloudDataproc/hadoop-connectors.git
    </developerConnection>
    <url>git@github.com:GoogleCloudDataproc/hadoop-connectors.git</url>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/GoogleCloudDataproc/hadoop-connectors/issues</url>
  </issueManagement>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <argLine/>

    <build.java.source.version>8</build.java.source.version>
    <build.java.target.version>8</build.java.target.version>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <gpg.skip>true</gpg.skip>

    <bigdataoss.version>2.2.22</bigdataoss.version>
    <bigquery-connector.version>1.2.1-SNAPSHOT</bigquery-connector.version>
    <apache.httpclient.version>4.5.13</apache.httpclient.version>
    <google.api.grpc.proto-google-iam-v1.version>1.1.7</google.api.grpc.proto-google-iam-v1.version>
    <google.api-client.version>2.0.1</google.api-client.version>
    <google.api-client-libraries.version>2.0.0</google.api-client-libraries.version>
    <google.api-bigquery.version>v2-rev20221028-${google.api-client-libraries.version}</google.api-bigquery.version>
    <google.api-iamcredentials.version>v1-rev20211203-${google.api-client-libraries.version}</google.api-iamcredentials.version>
    <google.api-storage.version>v1-rev20240105-${google.api-client-libraries.version}</google.api-storage.version>
    <google.auth.version>1.22.0</google.auth.version>
    <google.auto-value.version>1.10.4</google.auto-value.version>
    <google.cloud-bigquerystorage.version>2.39.1</google.cloud-bigquerystorage.version>
    <google.cloud-core.version>2.5.4</google.cloud-core.version>
    <google.cloud-storage.bom.version>2.37.0</google.cloud-storage.bom.version>
    <google.flogger.version>0.7.1</google.flogger.version>
    <google.gax.version>2.42.0</google.gax.version>
    <google.gson.version>2.8.9</google.gson.version>
    <google.guava.version>33.1.0-jre</google.guava.version>
    <google.http-client.version>1.42.3</google.http-client.version>
    <google.oauth-client.version>1.34.1</google.oauth-client.version>
    <google.protobuf.version>3.25.3</google.protobuf.version>
    <grpc.version>1.62.2</grpc.version>
    <hadoop.two.version>2.10.2</hadoop.two.version>
    <hadoop.three.version>3.2.4</hadoop.three.version>
    <opencensus.version>0.31.0</opencensus.version>

    <!-- Test dependencies -->
    <google.truth.version>1.1.3</google.truth.version>
    <junit.version>4.13.2</junit.version>
    <mockito.version>3.11.2</mockito.version>
    <system-lambda.version>1.2.0</system-lambda.version>
    <deploy.skip>true</deploy.skip>
    <nexus.remote.skip>false</nexus.remote.skip>
  </properties>

  <modules>
    <module>bigquery/pom.xml</module>
    <module>gcs/pom.xml</module>
    <module>gcsio/pom.xml</module>
    <module>util/pom.xml</module>
    <module>util-hadoop/pom.xml</module>
    <module>coverage/pom.xml</module>
  </modules>

  <profiles>
    <profile>
      <id>hadoop2</id>
      <properties>
        <hadoop.identifier>hadoop2</hadoop.identifier>
        <hadoop.version>${hadoop.two.version}</hadoop.version>
      </properties>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-annotations</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client-api</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>

    <profile>
      <id>hadoop3</id>
      <properties>
        <hadoop.identifier>hadoop3</hadoop.identifier>
        <hadoop.version>${hadoop.three.version}</hadoop.version>
      </properties>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client-api</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
            <type>pom</type>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client-runtime</artifactId>
            <version>${hadoop.version}</version>
            <scope>test</scope>
          </dependency>
          <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client-api</artifactId>
            <version>${hadoop.version}</version>
            <scope>provided</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
    </profile>

    <profile>
      <id>integration-test</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <includes>
                <include>**/*IntegrationTest.java</include>
              </includes>
              <reuseForks>false</reuseForks>
              <forkCount>4</forkCount>
              <argLine>-Xmx2g @{argLine}</argLine>
              <reportNameSuffix>sponge_log</reportNameSuffix>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>coverage</id>
      <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>
            <artifactId>maven-gpg-plugin</artifactId>
            <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>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.http-client</groupId>
        <artifactId>google-http-client-jackson2</artifactId>
        <version>${google.http-client.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-storage-bom</artifactId>
        <version>${google.cloud-storage.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.google.api-client</groupId>
        <artifactId>google-api-client-jackson2</artifactId>
        <version>${google.api-client.version}</version>
        <exclusions>
          <exclusion>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client-jackson2</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.apis</groupId>
        <artifactId>google-api-services-iamcredentials</artifactId>
        <version>${google.api-iamcredentials.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.apis</groupId>
        <artifactId>google-api-services-storage</artifactId>
        <version>${google.api-storage.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.oauth-client</groupId>
        <artifactId>google-oauth-client</artifactId>
        <version>${google.oauth-client.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.auth</groupId>
        <artifactId>google-auth-library-credentials</artifactId>
        <version>${google.auth.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.auth</groupId>
        <artifactId>google-auth-library-oauth2-http</artifactId>
        <version>${google.auth.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.apis</groupId>
        <artifactId>google-api-services-bigquery</artifactId>
        <version>${google.api-bigquery.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-bigquerystorage</artifactId>
        <version>${google.cloud-bigquerystorage.version}</version>
        <!-- TODO: https://github.com/GoogleCloudDataproc/hadoop-connectors/issues/1020 -->
        <exclusions>
          <exclusion>
            <groupId>io.grpc</groupId>
            <artifactId>*</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${google.gson.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.auto.value</groupId>
        <artifactId>auto-value-annotations</artifactId>
        <version>${google.auto-value.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${google.guava.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-alts</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-api</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-auth</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-context</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-core</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-census</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-grpclb</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>${grpc.version}</version>
        <scope>runtime</scope>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf-lite</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-stub</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-xds</artifactId>
        <version>${grpc.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.api.grpc</groupId>
        <artifactId>proto-google-iam-v1</artifactId>
        <version>${google.api.grpc.proto-google-iam-v1.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>${google.protobuf.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java-util</artifactId>
        <version>${google.protobuf.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>${apache.httpclient.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.flogger</groupId>
        <artifactId>flogger</artifactId>
        <version>${google.flogger.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.flogger</groupId>
        <artifactId>google-extensions</artifactId>
        <version>${google.flogger.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.flogger</groupId>
        <artifactId>flogger-system-backend</artifactId>
        <version>${google.flogger.version}</version>
        <scope>runtime</scope>
      </dependency>
      <dependency>
        <groupId>io.opencensus</groupId>
        <artifactId>opencensus-impl</artifactId>
        <version>${opencensus.version}</version>
      </dependency>
      <dependency>
        <groupId>io.opencensus</groupId>
        <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
        <version>${opencensus.version}</version>
      </dependency>
      <dependency>
        <groupId>io.opencensus</groupId>
        <artifactId>opencensus-contrib-grpc-metrics</artifactId>
        <version>${opencensus.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-core</artifactId>
        <version>${google.cloud-core.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.api</groupId>
        <artifactId>gax-grpc</artifactId>
        <version>${google.gax.version}</version>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.version}</version>
        <classifier>tests</classifier>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-mapreduce-client-common</artifactId>
        <version>${hadoop.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-testing</artifactId>
        <version>${grpc.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.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.guava</groupId>
        <artifactId>guava-testlib</artifactId>
        <version>${google.guava.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.google.truth</groupId>
        <artifactId>truth</artifactId>
        <version>${google.truth.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.google.truth.extensions</groupId>
        <artifactId>truth-java8-extension</artifactId>
        <version>${google.truth.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.github.stefanbirkner</groupId>
        <artifactId>system-lambda</artifactId>
        <version>${system-lambda.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <!-- enable project.version substitution. -->
        <filtering>true</filtering>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.0.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
          <executions>
            <execution>
              <id>default-jar</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
                <goal>test-jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M3</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.2.4</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.7</version>
          <executions>
            <execution>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <configuration>
            <skip>${deploy.skip}</skip>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-tools</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.3.9,)</version>
                </requireMavenVersion>
                <requireSameVersions>
                  <dependencies>
                    <dependency>io.grpc</dependency>
                  </dependencies>
                </requireSameVersions>
                <requireSameVersions>
                  <dependencies>
                    <dependency>com.google.protobuf</dependency>
                  </dependencies>
                </requireSameVersions>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*IntegrationTest.java</exclude>
          </excludes>
          <reuseForks>false</reuseForks>
          <forkCount>3</forkCount>
          <argLine>-Xmx3g @{argLine}</argLine>
          <reportNameSuffix>sponge_log</reportNameSuffix>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${build.java.source.version}</source>
          <target>${build.java.target.version}</target>
          <annotationProcessorPaths>
            <path>
              <groupId>com.google.auto.value</groupId>
              <artifactId>auto-value</artifactId>
              <version>${google.auto-value.version}</version>
            </path>
            <path>
              <groupId>com.google.auto.service</groupId>
              <artifactId>auto-service</artifactId>
              <version>1.0-rc7</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>2.12.2</version>
        <configuration>
          <formats>
            <format>
              <includes>
                <include>*.md</include>
                <include>.gitignore</include>
              </includes>
              <trimTrailingWhitespace/>
              <endWithNewline/>
            </format>
          </formats>
          <java>
            <toggleOffOn>
              <off>fmt:off</off>
              <on>fmt:on</on>
            </toggleOffOn>
            <googleJavaFormat>
              <version>1.7</version>
            </googleJavaFormat>
          </java>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
