<?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>2</version>
  <packaging>pom</packaging>

  <name>Aiven Commons Parent</name>

  <description>This is the parent POM for a collection of utility jars with minimal external dependencies.  All external dependencies are
        provided by the environment or are for testing only.  For example the kafka-config module expects Kafka to be present.</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>

  <developers>
    <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>
    <site>
      <id>staging</id>
      <!--  For the URL to resolve to the default URL as described in the Apache Site Plugin documentation this URL
            must be invalid. A ticket is open to resolve this issue. See https://github.com/apache/maven-site-plugin/issues/1140
            -->
      <url>invalid:url</url>
    </site>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <java.version>17</java.version>
    <com.google.guava.version>32.0.1-jre</com.google.guava.version>
    <com.google.re2j.version>1.7</com.google.re2j.version>
    <com.google.auto.value.version>1.10.2</com.google.auto.value.version>
    <google.cloud.bom.version>26.33.0</google.cloud.bom.version>
    <kafka.version>3.9.1</kafka.version>
    <kafka.scala.version>2.12</kafka.scala.version>
    <slf4j.version>2.0.11</slf4j.version>

    <!-- standard package versions -->
    <commons.collection.version>4.4</commons.collection.version>
    <commons.io.version>2.21.0</commons.io.version>
    <commons.lang3.version>3.17.0</commons.lang3.version>

    <!-- testing versions -->
    <junit.version>5.10.2</junit.version>
    <assertj.version>3.26.0</assertj.version>
    <awaitility.version>4.2.1</awaitility.version>
    <testcontainers.version>1.20.6</testcontainers.version>

    <!-- plugin versions -->
    <rat.version>0.17</rat.version>
    <assembly.plugin.version>3.7.1</assembly.plugin.version>
    <checkstyle.plugin.version>3.3.1</checkstyle.plugin.version>
    <compiler.plugin.version>3.8.1</compiler.plugin.version>
    <exec.plugin.version>3.2.0</exec.plugin.version>
    <surefire.plugin.version>3.5.3</surefire.plugin.version>

    <!-- site versions -->
    <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>
      <!-- provided packages -->
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>connect-api</artifactId>
        <version>${kafka.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>connect-runtime</artifactId>
        <version>${kafka.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka-clients</artifactId>
        <version>${kafka.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>${commons.collection.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons.io.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons.lang3.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-text</artifactId>
        <version>1.14.0</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>testcontainers-bom</artifactId>
        <version>${testcontainers.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <!-- testing packages -->
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.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>org.apache.kafka</groupId>
        <artifactId>kafka_${kafka.scala.version}</artifactId>
        <version>${kafka.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_${kafka.scala.version}</artifactId>
        <version>${kafka.version}</version>
        <classifier>test</classifier>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka-clients</artifactId>
        <version>${kafka.version}</version>
        <classifier>test</classifier>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>connect-runtime</artifactId>
        <version>${kafka.version}</version>
        <classifier>test</classifier>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>${awaitility.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>maven-repo</id>
      <url>https://repo1.maven.org/maven2/</url>
      <layout>default</layout>
    </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>
      <layout>default</layout>
    </repository>

    <repository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>maven</id>
      <url>https://mvnrepository.com</url>
      <layout>default</layout>
    </repository>

  </repositories>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>0.9.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.27.0</version>
          <configuration>
            <minimumTokens>100</minimumTokens>
            <targetJdk>${java.version}</targetJdk>
            <analysisCache>true</analysisCache>
            <excludeRoots>
              <excludeRoot>target/generated-sources/stubs</excludeRoot>
            </excludeRoots>
            <verbose>true</verbose>
            <linkXRef>false</linkXRef>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>2.43.0</version>
          <configuration>
            <java>
              <eclipse></eclipse>
              <removeUnusedImports></removeUnusedImports>
            </java>
            <pom>
              <sortPom></sortPom>
            </pom>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.12.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.21.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.9.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.2</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${compiler.plugin.version}</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${assembly.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${surefire.plugin.version}</version>
          <configuration>
            <excludedGroups>integration</excludedGroups>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${surefire.plugin.version}</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>${checkstyle.plugin.version}</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>${exec.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</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>3.2.8</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>${rat.version}</version>
        <executions>
          <execution>
            <id>Release Audit Check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>test</phase>
            <configuration>
              <inputExcludes>
                <expression>/CODE_OF_CONDUCT.md</expression>
                <expression>/CONTRIBUTING.md</expression>
                <expression>/SECURITY.md</expression>
              </inputExcludes>
            </configuration>
          </execution>
        </executions>
      </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>
        <executions>
          <execution>
            <id>Format code</id>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>process-sources</phase>
          </execution>
        </executions>
      </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>
        <version>3.3.1</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>3.2.8</version>
        <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>
        <version>0.9.0</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
          <deploymentName>${groupId} ${artifactId} v${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>ci</id>
      <modules>
        <module>collections</module>
        <module>google-utils</module>
        <module>kafka-config</module>
        <module>kafka-testkit</module>
        <module>strings</module>
        <module>system</module>
        <module>velocity</module>
      </modules>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <redirectTestOutputToFile>true</redirectTestOutputToFile>
                <parallel>classes</parallel>
                <useUnlimitedThreads>true</useUnlimitedThreads>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>build-all</id>
      <modules>
        <module>collections</module>
        <module>google-utils</module>
        <module>kafka-config</module>
        <module>kafka-testkit</module>
        <module>strings</module>
        <module>system</module>
        <module>velocity</module>
      </modules>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.9.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
