<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2025 Aiven Oy and project contributors

    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.

    SPDX-License-Identifier: Apache-2
-->
<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>io.aiven.commons</groupId>
  <artifactId>aiven-commons</artifactId>
  <version>4</version>
  <packaging>pom</packaging>

  <name>Aiven Commons Parent</name>

  <description>This is the suggested parent POM for Aiven projects.</description>

  <url>https://github.com/Aiven-Open/aiven-commons</url>

  <inceptionYear>2025</inceptionYear>

  <organization>
    <name>Aiven</name>
    <url>https://www.aiven.io</url>
  </organization>

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

  <!-- please order developers by surname then given name -->
  <developers>
    <developer>
      <id>aindriu-aiven</id>
      <name>Aindriú Lavelle</name>
      <email>aindriu.lavelle@aiven.io</email>
      <organization>Aiven, OY</organization>
      <organizationUrl>https://aiven.io</organizationUrl>
      <timezone>Europe/Dublin</timezone>
    </developer>
    <developer>
      <id>claudenw</id>
      <name>Claude Warren</name>
      <email>claude.warren@aiven.io</email>
      <organization>Aiven, OY</organization>
      <organizationUrl>https://aiven.io</organizationUrl>
      <timezone>Europe/Dublin</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/Aiven-Open/aiven-commons.git</connection>
    <developerConnection>scm:git:git@github.com:Aiven-Open/aiven-commons.git</developerConnection>
    <tag>HEAD</tag>
    <url>https://github.com/Aiven-Open/aiven-commons</url>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>central-snapshot</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <!-- config properties (please keep in alphabetical order) -->
    <jdk.version>17</jdk.version>
    <maven.compiler.source>${jdk.version}</maven.compiler.source>
    <maven.compiler.target>${jdk.version}</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- standard package versions (please keep in alphabetical order)-->
    <apache.avro.version>1.12.1</apache.avro.version>
    <apache.parquet.version>1.17.0</apache.parquet.version>
    <com.google.auto.value.version>1.10.2</com.google.auto.value.version>
    <com.google.guava.version>32.0.1-jre</com.google.guava.version>
    <com.google.re2j.version>1.7</com.google.re2j.version>
    <commons.codec.version>1.21.0</commons.codec.version>
    <commons.collection4.version>4.4</commons.collection4.version>
    <commons.csv.version>1.14.1</commons.csv.version>
    <commons.io.version>2.21.0</commons.io.version>
    <commons.lang3.version>3.17.0</commons.lang3.version>
    <commons.text.version>1.15.0</commons.text.version>
    <google.cloud.bom.version>26.83.0</google.cloud.bom.version>
    <kafka.scala.version>2.12</kafka.scala.version>
    <kafka.version>3.9.2</kafka.version>
    <maven.artifact.version>3.9.6</maven.artifact.version>
    <slf4j.version>2.0.11</slf4j.version>
    <snappy.version>1.1.10.8</snappy.version>
    <spotbugs.annotations.version>4.9.8</spotbugs.annotations.version>
    <zstd.version>1.5.7-7</zstd.version>

    <!-- testing versions (please keep in alphabetical order) -->
    <assertj.version>3.27.7</assertj.version>
    <awaitility.version>4.2.1</awaitility.version>
    <junit.version>6.1.0</junit.version>
    <mockito.version>5.23.0</mockito.version>
    <testcontainers.version>2.0.5</testcontainers.version>

    <!-- plugin versions (please keep in alphabetical order) -->
    <plugin.assembly>3.8.0</plugin.assembly>
    <plugin.checkstyle>3.6.0</plugin.checkstyle>
    <plugin.compiler>3.15.0</plugin.compiler>
    <plugin.exec>3.6.3</plugin.exec>
    <plugin.gpg>3.2.8</plugin.gpg>
    <plugin.jar>3.5.0</plugin.jar>
    <plugin.javadoc>3.12.0</plugin.javadoc>
    <plugin.pmd>3.28.0</plugin.pmd>
    <plugin.project.info>3.9.0</plugin.project.info>
    <plugin.properties>1.3.0</plugin.properties>
    <plugin.rat>0.18</plugin.rat>
    <plugin.resources>3.5.0</plugin.resources>
    <plugin.site>3.21.0</plugin.site>
    <plugin.sonatype>0.10.0</plugin.sonatype>
    <plugin.source>3.4.0</plugin.source>
    <plugin.spotbugs>4.9.8.3</plugin.spotbugs>
    <plugin.spotless>3.5.1</plugin.spotless>
    <plugin.surefire>3.5.5</plugin.surefire>

    <!-- site versions (please keep in alphabetical order) -->
    <velocity.core.version>2.4.1</velocity.core.version>
    <velocity.tools.version>3.1</velocity.tools.version>

  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- imported poms -->
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>libraries-bom</artifactId>
        <version>${google.cloud.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
        <exclusions>
          <exclusion>
            <groupId>com.google.auto.value</groupId>
            <artifactId>auto-value</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>testcontainers-bom</artifactId>
        <version>${testcontainers.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
        <checksumPolicy>fail</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>Maven</id>
      <url>https://repo1.maven.org/maven2/</url>
    </repository>

    <repository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <url>https://central.sonatype.com/repository/maven</url>
    </repository>

    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
      <id>central-snapshot</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </repository>
  </repositories>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>${plugin.spotbugs}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>properties-maven-plugin</artifactId>
          <version>${plugin.properties}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>${plugin.sonatype}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>${plugin.pmd}</version>
          <configuration>
            <minimumTokens>100</minimumTokens>
            <targetJdk>${jdk.version}</targetJdk>
            <analysisCache>true</analysisCache>
            <verbose>true</verbose>
            <linkXRef>false</linkXRef>
          </configuration>
          <executions>
            <execution>
              <id>PMD check</id>
              <goals>
                <goal>check</goal>
                <goal>cpd-check</goal>
              </goals>
              <phase>test</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${plugin.spotless}</version>
          <configuration>
            <java>
              <googleJavaFormat/>
              <removeUnusedImports/>
            </java>
            <pom>
              <sortPom>
                <expandEmptyElements>false</expandEmptyElements>
              </sortPom>
            </pom>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>apply</goal>
              </goals>
              <phase>process-sources</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${plugin.javadoc}</version>
          <executions>
            <execution>
              <id>Generate Javadoc</id>
              <goals>
                <goal>javadoc</goal>
              </goals>
              <phase>compile</phase>
              <configuration>
                <failOnWarnings>true</failOnWarnings>
              </configuration>
            </execution>
            <execution>
              <id>Aggregate Javadoc</id>
              <goals>
                <goal>aggregate</goal>
              </goals>
              <phase>pre-site</phase>
            </execution>
            <execution>
              <id>attach-docs</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <phase>verify</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${plugin.resources}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${plugin.site}</version>
          <configuration>
            <generateReports>true</generateReports>
            <generateProjectInfo>true</generateProjectInfo>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>${plugin.project.info}</version>
          <executions>
            <execution>
              <goals>
                <goal>dependencies</goal>
                <goal>dependency-convergence</goal>
                <goal>distribution-management</goal>
                <goal>issue-management</goal>
                <goal>plugin-management</goal>
                <goal>plugins</goal>
                <goal>team</goal>
                <goal>scm</goal>
                <goal>summary</goal>
              </goals>
              <phase>prepare-package</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${plugin.jar}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${plugin.compiler}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${plugin.assembly}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${plugin.surefire}</version>
          <configuration>
            <excludedGroups>integration</excludedGroups>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${plugin.surefire}</version>
          <executions>
            <execution>
              <id>embedded-integration-test</id>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
              <configuration>
                <groups>integration</groups>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${plugin.checkstyle}</version>
          <configuration>
            <configLocation>google_checks.xml</configLocation>
            <suppressionsLocation>config/checkstyle/suppressions.xml</suppressionsLocation>
            <violationSeverity>warning</violationSeverity>
          </configuration>
          <executions>
            <execution>
              <id>validate</id>
              <goals>
                <goal>check</goal>
                <goal>checkstyle</goal>
              </goals>
              <phase>validate</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${plugin.exec}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${plugin.source}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
              <phase>verify</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${plugin.gpg}</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <goals>
                <goal>sign</goal>
              </goals>
              <phase>deploy</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>${plugin.rat}</version>
          <executions>
            <execution>
              <id>Release Audit Check</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>test</phase>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <inputExclude>**/CHANGE_LOG.md</inputExclude>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <executions>
          <execution>
            <id>PMD check</id>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
            <phase>test</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>Generate Javadoc</id>
            <goals>
              <goal>javadoc</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <failOnWarnings>true</failOnWarnings>
            </configuration>
          </execution>
          <execution>
            <id>Aggregate Javadoc</id>
            <goals>
              <goal>aggregate</goal>
            </goals>
            <phase>pre-site</phase>
          </execution>
          <execution>
            <id>attach-docs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>dependencies</goal>
              <goal>dependency-convergence</goal>
              <goal>distribution-management</goal>
              <goal>issue-management</goal>
              <goal>plugin-management</goal>
              <goal>plugins</goal>
              <goal>team</goal>
              <goal>scm</goal>
              <goal>summary</goal>
            </goals>
            <phase>prepare-package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <goals>
              <goal>sign</goal>
            </goals>
            <phase>deploy</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central-snapshot</publishingServerId>
          <deploymentName>${project.groupId} ${project.artifactId} v${project.version}</deploymentName>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <id>aggregate</id>
            <reports>
              <report>aggregate</report>
            </reports>
            <inherited>false</inherited>
          </reportSet>
          <reportSet>
            <id>default</id>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <reportSets>
          <reportSet>
            <!-- by default, id = "default" -->
            <reports>
              <!-- select non-aggregate reports -->
              <report>pmd</report>
              <report>cpd</report>
            </reports>
          </reportSet>
          <reportSet>
            <!-- aggregate reportSet, to define in poms having modules -->
            <id>aggregate</id>
            <!-- don't run aggregate in child modules -->
            <reports>
              <report>aggregate-pmd</report>
              <report>aggregate-cpd</report>
            </reports>
            <inherited>false</inherited>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>sign</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>publish-snapshot</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central-snapshot</publishingServerId>
              <centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots</centralSnapshotsUrl>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
