<?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.13</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>

    <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>

    <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>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>

        <java.version>21</java.version>
        <java.compiler.opts/>
        <java.module.opts/>
        <java.runtime.opts>${java.module.opts}</java.runtime.opts>
        <java.doc.opts>-Xdoclint:none</java.doc.opts>

        <skip.unit.tests>false</skip.unit.tests>
        <skip.integration.tests>false</skip.integration.tests>

        <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>

        <surefire.jvm.common.args>-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp</surefire.jvm.common.args>
        <surefire.jvm.args>-Xmx640m ${surefire.jvm.common.args}</surefire.jvm.args>

        <surefire.forkCount>1</surefire.forkCount>
        <surefire.reuseForks>true</surefire.reuseForks>
        <failsafe.forkCount>1</failsafe.forkCount>
        <failsafe.reuseForks>false</failsafe.reuseForks>

        <maven-release.version>3.3.1</maven-release.version>
        <maven-deploy.version>3.1.4</maven-deploy.version>
        <maven-site.version>3.22.0</maven-site.version>
        <maven-surefire.version>3.5.5</maven-surefire.version>
        <maven-failsafe.version>3.5.5</maven-failsafe.version>
        <maven-enforcer.version>3.6.3</maven-enforcer.version>
        <maven-compiler.version>3.8.1</maven-compiler.version>
        <maven-jar.version>3.5.0</maven-jar.version>
        <maven-scm.version>2.2.1</maven-scm.version>
        <maven-project-info.version>3.9.0</maven-project-info.version>

        <jacoco.version>0.8.14</jacoco.version>
        <spotbugs.version>4.9.8.3</spotbugs.version>
        <codehaus.versions.version>2.21.0</codehaus.versions.version>
        <codehause.buildnumber.version>3.3.0</codehause.buildnumber.version>
        <sonatype.central-publishing>0.8.0</sonatype.central-publishing>
        <talos.version>1.0.4</talos.version>

        <serenity.version>5.3.10</serenity.version>
        <serenity.tags/>
    </properties>

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

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

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

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

    <dependencies>
    </dependencies>

    <profiles>

        <profile>
            <id>dev</id>
            <properties>
                <skip.integration.tests>true</skip.integration.tests>
                <skip.unit.tests>true</skip.unit.tests>
            </properties>
            <activation>
                <property>
                    <name>!microfalx.non_development</name>
                </property>
            </activation>
        </profile>

        <profile>
            <id>unit-test</id>
            <properties>
                <skip.integration.tests>true</skip.integration.tests>
                <skip.unit.tests>false</skip.unit.tests>
            </properties>
        </profile>

        <profile>
            <id>integration-test</id>
            <properties>
                <skip.integration.tests>false</skip.integration.tests>
                <skip.surefire.tests>false</skip.surefire.tests>
                <skip.unit.tests>true</skip.unit.tests>
                <failsafe.include.pattern>**/*IntegrationTest.java</failsafe.include.pattern>
            </properties>
        </profile>

        <profile>
            <id>system-test</id>
            <properties>
                <skip.integration.tests>false</skip.integration.tests>
                <skip.unit.tests>true</skip.unit.tests>
                <maven.test.skip>false</maven.test.skip>
                <failsafe.include.pattern>**/*SystemTest.java</failsafe.include.pattern>
            </properties>
        </profile>

        <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>
                            <docencoding>UTF-8</docencoding>
                            <notimestamp>true</notimestamp>
                            <doclint>none</doclint>
                            <offline>true</offline>
                            <show>public</show>
                            <validateLinks>false</validateLinks>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                    <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                </manifest>
                            </archive>
                        </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>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <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>

    <build>
        <pluginManagement>
            <plugins>

                <!-- Maven -->

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

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar.version}</version>
                </plugin>

                <!-- Others -->

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>

                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${spotbugs.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${codehaus.versions.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>${codehause.buildnumber.version}</version>
                </plugin>

                <plugin>
                    <groupId>net.microfalx.talos</groupId>
                    <artifactId>talos-maven-plugin</artifactId>
                    <version>${talos.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-api</artifactId>
                    <version>${maven-scm.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>${maven-scm.version}</version>
                </plugin>

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

                <plugin>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-svnexe</artifactId>
                    <version>${maven-scm.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer.version}</version>
                </plugin>

                <plugin>
                    <groupId>net.serenity-bdd.maven.plugins</groupId>
                    <artifactId>serenity-maven-plugin</artifactId>
                    <version>${serenity.version}</version>
                    <configuration>
                        <tags>${serenity.tags}</tags>
                        <reports>single-page-html,navigator</reports>
                    </configuration>
                    <executions>
                        <execution>
                            <id>serenity-reports</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>aggregate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>net.serenity-bdd</groupId>
                            <artifactId>serenity-single-page-report</artifactId>
                            <version>${serenity.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.serenity-bdd</groupId>
                            <artifactId>serenity-navigator-report</artifactId>
                            <version>${serenity.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${sonatype.central-publishing}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <deploymentName>${project.name}</deploymentName>
                        <publishingServerId>maven.central</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                    </configuration>
                </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-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>true</addMavenDescriptor>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${maven.build.number}</Implementation-Build>
                            <Build-Id>${build.number}</Build-Id>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                        </manifestEntries>
                        <index>true</index>
                    </archive>
                </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>
                    <preparationGoals>clean install</preparationGoals>
                    <arguments>-DskipTests</arguments>
                    <goals>clean deploy</goals>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                    <scmCommentPrefix>Release></scmCommentPrefix>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <retryFailedDeploymentCount>3</retryFailedDeploymentCount>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>${skip.unit.tests}</skip>
                    <skipTests>${skip.unit.tests}</skipTests>
                    <forkCount>${surefire.forkCount}</forkCount>
                    <reuseForks>${surefire.reuseForks}</reuseForks>
                    <forkedProcessExitTimeoutInSeconds>60</forkedProcessExitTimeoutInSeconds>
                    <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
                    <testFailureIgnore>true</testFailureIgnore>
                    <runOrder>alphabetical</runOrder>
                    <trimStackTrace>false</trimStackTrace>
                    <argLine>-Xshare:off ${surefire.jvm.args}</argLine>
                    <excludes>
                        <exclude>**/Abstract*TestCase.java</exclude>
                        <exclude>**/Abstract*Test.java</exclude>
                        <exclude>**/*PerformanceTest.java</exclude>
                        <exclude>**/*IntegrationTest.java</exclude>
                        <exclude>**/*SystemTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <forkCount>${failsafe.forkCount}</forkCount>
                    <reuseForks>${failsafe.reuseForks}</reuseForks>
                    <threadCountClasses>${failsafe.forkCount}</threadCountClasses>
                    <forkedProcessExitTimeoutInSeconds>60</forkedProcessExitTimeoutInSeconds>
                    <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
                    <argLine>${surefire.jvm.args}</argLine>

                    <testFailureIgnore>true</testFailureIgnore>
                    <skip>${skip.integration.tests}</skip>
                    <skipTests>${skip.integration.tests}</skipTests>
                    <runOrder>alphabetical</runOrder>
                    <trimStackTrace>false</trimStackTrace>
                    <parallel>classes</parallel>
                    <excludes>
                        <exclude>**/Abstract*TestCase.java</exclude>
                        <exclude>**/Abstract*Test.java</exclude>
                    </excludes>
                    <includes>
                        <include>${failsafe.include.pattern}</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </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>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <buildNumberPropertyName>maven.build.number</buildNumberPropertyName>
                    <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                    <shortRevisionLength>8</shortRevisionLength>
                </configuration>

            </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).*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>
                        <rules>
                            <rule>
                                <groupId>net.serenity-bdd</groupId>
                                <ignoreVersions>
                                    <ignoreVersion>
                                        <type>regex</type>
                                        <version>5.*</version>
                                    </ignoreVersion>
                                </ignoreVersions>
                            </rule>
                        </rules>
                    </ruleSet>
                </configuration>
            </plugin>

            <plugin>
                <groupId>net.microfalx.talos</groupId>
                <artifactId>talos-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-number</id>
                        <goals>
                            <goal>build-number</goal>
                        </goals>
                    </execution>
                </executions>
            </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>

</project>
