<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 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">
  <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>4.0.0</version>
  <packaging>pom</packaging>

  <url>https://github.com/GoogleCloudDataproc/hadoop-connectors</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 LLC</organization>
      <organizationUrl>https://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>

  <properties>
    <argLine/>

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

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

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

    <bigdataoss.version>4.0.0</bigdataoss.version>

    <google.auto-value.version>1.10.4</google.auto-value.version>
    <google.cloud.library.bom.version>26.69.0</google.cloud.library.bom.version>
    <google.error-prone.version>2.16</google.error-prone.version>
    <google.error-prone-annotations.version>2.38.0</google.error-prone-annotations.version>
    <google.flogger.version>0.7.4</google.flogger.version>
    <google.guava.version>33.4.8-jre</google.guava.version>
    <google.java-format.version>1.15.0</google.java-format.version>
    <hadoop.version>3.4.2</hadoop.version>
    <opencensus.version>0.31.1</opencensus.version>

    <!-- Test dependencies -->
    <google.truth.version>1.1.3</google.truth.version>
    <junit.version>4.13.2</junit.version>
    <mockito.version>4.10.0</mockito.version>
    <system-lambda.version>1.2.1</system-lambda.version>
    <!-- TODO: remove AssertJ dependency when Hadoop will fix transitive test dependencies -->
    <assertj.version>3.14.0</assertj.version>
    <deploy.skip>true</deploy.skip>
    <central.publishing.skip>false</central.publishing.skip>
    <java.addopens.args>--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED</java.addopens.args>
  </properties>

  <modules>
    <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>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 ${java.addopens.args} @{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.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.8.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>false</autoPublish>
              <skipPublishing>${central.publishing.skip}</skipPublishing>
              <checksums>required</checksums>
            </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>
                <configuration>
                  <doclint>none</doclint>
                  <failOnError>false</failOnError>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--
     This is a profile to enable the use of the ASF snapshot and staging repositories
     during a build. It is useful when testing against nightly or RC releases of dependencies.
     -->
    <profile>
      <id>snapshots-and-staging</id>
      <!-- override point for ASF staging/snapshot repos -->
      <pluginRepositories>
        <pluginRepository>
          <id>ASF Staging</id>
          <url>https://repository.apache.org/content/groups/staging/</url>
        </pluginRepository>
        <pluginRepository>
          <id>ASF Snapshots</id>
          <url>https://repository.apache.org/content/repositories/snapshots/</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <releases>
            <enabled>false</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
      <repositories>
        <repository>
          <id>ASF Staging</id>
          <url>https://repository.apache.org/content/groups/staging/</url>
        </repository>
        <repository>
          <id>ASF Snapshots</id>
          <url>https://repository.apache.org/content/repositories/snapshots/</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <releases>
            <enabled>false</enabled>
          </releases>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>libraries-bom</artifactId>
        <version>${google.cloud.library.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </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>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>com.google.errorprone</groupId>
        <artifactId>error_prone_annotations</artifactId>
        <version>${google.error-prone-annotations.version}</version>
      </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>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>

      <!-- 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>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>
      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client-runtime</artifactId>
        <version>${hadoop.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.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.4.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.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.10.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.0.0-M7</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M7</version>
        </plugin>
        <plugin>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>2.28.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 --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED @{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>
          <compilerArgs>
            <arg>-XDcompilePolicy=simple</arg>
            <arg>-Xplugin:ErrorProne</arg>
          </compilerArgs>
          <annotationProcessorPaths>
            <path>
              <groupId>com.google.errorprone</groupId>
              <artifactId>error_prone_core</artifactId>
              <version>${google.error-prone.version}</version>
            </path>
            <path>
              <groupId>com.google.auto.value</groupId>
              <artifactId>auto-value</artifactId>
              <version>${google.auto-value.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <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>${google.java-format.version}</version>
            </googleJavaFormat>
          </java>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>