<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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>

    <groupId>net.microfalx</groupId>
    <artifactId>pom</artifactId>
    <version>1.0.3</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>23</version>
    </parent>

    <name>Parent POM</name>
    <description>A parent POM for Java projects.</description>
    <url>https://github.com/adrian-tarau/pom</url>

    <organization>
        <name>Adrian Tarau</name>
        <url>https://github.com/adrian-tarau</url>
    </organization>

    <scm>
        <connection>scm:git:https://github.com/adrian-tarau/pom</connection>
        <developerConnection>scm:git:https://github.com/adrian-tarau/pom</developerConnection>
        <url>https://github.com/adrian-tarau/pom/tree/main</url>
    </scm>

    <issueManagement>
        <system>github</system>
        <url>https://github.com/adrian-tarau/pom/issues</url>
    </issueManagement>

    <inceptionYear>2024</inceptionYear>

    <properties>
        <java.version>21</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jacoco.file>jacoco.exec</jacoco.file>
        <jacoco.ut.dest>${project.build.directory}/${jacoco.file}</jacoco.ut.dest>
        <jacoco.reports>${project.reporting.outputDirectory}/jacoco</jacoco.reports>
    </properties>

    <prerequisites>
        <maven>3.6.3</maven>
    </prerequisites>

    <developers>
        <developer>
            <name>Adrian Tarau</name>
            <email>adrian@tarau.net</email>
        </developer>
    </developers>

    <repositories>
        <repository>
            <id>confluent</id>
            <url>https://packages.confluent.io/maven/</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
        </dependencies>
    </dependencyManagement>

    <dependencies>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>

                <!-- Maven -->

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.1.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-surefire-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>

                <!-- Others -->

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.12</version>
                </plugin>

                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>4.8.6.6</version>
                </plugin>

                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>3.4.4</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.18.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-api</artifactId>
                    <version>2.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>2.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-svn-commons</artifactId>
                    <version>2.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-svnexe</artifactId>
                    <version>2.1.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </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>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>dist,sign</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <runOrder>alphabetical</runOrder>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <formats>XML</formats>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${jacoco.dest}</destFile>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <dataFile>${jacoco.dest}</dataFile>
                            <excludes>
                                <exclude>**/*.zip</exclude>
                            </excludes>
                            <outputDirectory>${jacoco.reports}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <failOnError>false</failOnError>
                    <onlyAnalyze>net.microfalx.-</onlyAnalyze>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.8, 4.0)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>[21, 23)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <configuration>
                    <ruleSet>
                        <ignoreVersions>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*beta.*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*alpha.*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*(ce|ccs)</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*rc\d*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*cr\d*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*dev\d*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*preview.*</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i).*m\d+</version>
                            </ignoreVersion>
                            <ignoreVersion>
                                <type>regex</type>
                                <version>(?i)20\d{6,12}.*</version>
                            </ignoreVersion>
                        </ignoreVersions>
                    </ruleSet>
                </configuration>
            </plugin>

        </plugins>

    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>dist</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <quiet>true</quiet>
                            <encoding>UTF-8</encoding>
                            <notimestamp>true</notimestamp>
                            <doclint>none</doclint>
                            <offline>true</offline>
                            <show>public</show>
                            <validateLinks>false</validateLinks>
                        </configuration>
                        <executions>
                            <execution>
                                <id>module-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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

</project>
