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

    <artifactId>infra-pom</artifactId>
    <version>23</version>

    <parent>
        <groupId>com.flowlogix</groupId>
        <artifactId>base-pom</artifactId>
        <version>23</version>
    </parent>

    <name>Infrastructure POM</name>
    <description>Opinionated infrastructure to be used as parent POM</description>
    <url>https://github.com/flowlogix/base-pom</url>

    <properties>
        <project.build.outputTimestamp>2024-07-24T15:48:39Z</project.build.outputTimestamp>
        <docs.phase>deploy</docs.phase>
        <delombok.phase>none</delombok.phase>
        <snippet.path.p1>${project.build.sourceDirectory}</snippet.path.p1>
        <snippet.path.p2>${project.build.testSourceDirectory}</snippet.path.p2>
        <snippet.path.p3>${project.basedir}/src/demo/java</snippet.path.p3>
        <snippet.path>${snippet.path.p1}:${snippet.path.p2}:${snippet.path.p3}</snippet.path>
        <release.profile>release-flowlogix-to-central</release.profile>
        <release.profiles>${release.profile}</release.profiles>
        <gpg.keyname>Flow Logix, Inc.</gpg.keyname>
        <staging.server>flowlogix-maven-central-s01</staging.server>
        <nexus.url>https://s01.oss.sonatype.org</nexus.url>
        <jboss.unzip.url>https://repository.jboss.org/nexus/content/repositories/unzip/org/jboss</jboss.unzip.url>
        <central.archive.url>https://oss.sonatype.org/service/local/repositories/releases/archive</central.archive.url>
        <arquillian.launch />
        <webdriver.browser>chromeheadless</webdriver.browser>
        <jacocoAddress>localhost</jacocoAddress>
        <jacocoPort>52212</jacocoPort>
        <jacocoReset>true</jacocoReset>
        <jacocoAgent />
        <jdk11SurefireOptions>-Xshare:off</jdk11SurefireOptions>
        <jdk11FailsafeOptions />
        <compiler.show.warnings>true</compiler.show.warnings>
        <compiler.deprecation.arg>-Xlint:deprecation</compiler.deprecation.arg>
        <compiler.unchecked.arg>-Xlint:unchecked</compiler.unchecked.arg>
        <compiler.parameters.arg>-parameters</compiler.parameters.arg>
        <compiler.annotation.processing />
        <test.parallel>classes</test.parallel>
        <it.test.parallel>${test.parallel}</it.test.parallel>
        <test.thread.count>10</test.thread.count>
        <test.run.order>random</test.run.order>
        <test.redirect.to.file>true</test.redirect.to.file>
        <deploy.at-end>true</deploy.at-end>
        <jar.skip-if-empty>true</jar.skip-if-empty>
        <javadoc.doclint>all,-reference</javadoc.doclint>
        <javadoc.sourcepath>${project.build.sourceDirectory}
            :${project.build.directory}/generated-sources/annotations</javadoc.sourcepath>
        <javadoc.snippet.path>${snippet.path}</javadoc.snippet.path>
        <javadoc.snippet.path.options>--snippet-path ${javadoc.snippet.path}</javadoc.snippet.path.options>
        <checkstyle.configLocation>checkstyle.xml</checkstyle.configLocation>
        <checkstyle.headerLocation>flowlogix-header.txt</checkstyle.headerLocation>
        <checkstyle.supressionsLocation />
        <checkstyle.excludes>**/module-info.java</checkstyle.excludes>

        <jdk.minimum.version>${maven.compiler.release}</jdk.minimum.version>
        <maven.minimum.version>3.6</maven.minimum.version>
        <jakarta.ee.version>10.0.0</jakarta.ee.version>
        <lombok.version>1.18.34</lombok.version>
        <shrinkwrap.api.version>1.2.6</shrinkwrap.api.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>${staging.server}</id>
            <url>${nexus.url}/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>jakarta.platform</groupId>
                <artifactId>jakarta.jakartaee-core-api</artifactId>
                <version>${jakarta.ee.version}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.jboss.shrinkwrap</groupId>
                <artifactId>shrinkwrap-api</artifactId>
                <version>${shrinkwrap.api.version}</version>
                <optional>true</optional>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules combine.children="append">
                                <requireMavenVersion>
                                    <version>${maven.minimum.version}</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>${jdk.minimum.version}</version>
                                    <message>Required JDK version to build is at least ${maven.compiler.release}</message>
                                </requireJavaVersion>
                                <dependencyConvergence />
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>enforce-maven-ban-junit4</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>junit:junit</exclude>
                                    </excludes>
                                    <message>JUnit 4 is prohibited</message>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.6.0</version>
                <executions>
                    <execution>
                        <id>add-demos-parse-version</id>
                        <configuration>
                            <sources>
                                <source>src/demo/java</source>
                            </sources>
                            <versionString>${jakarta.ee.version}</versionString>
                            <propertyPrefix>jakarta.ee.parsed</propertyPrefix>
                        </configuration>
                        <phase>validate</phase>
                        <goals>
                            <goal>add-test-source</goal>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.4.0</version>
                <configuration>
                    <configLocation>${checkstyle.configLocation}</configLocation>
                    <headerLocation>${checkstyle.headerLocation}</headerLocation>
                    <suppressionsLocation>${checkstyle.supressionsLocation}</suppressionsLocation>
                    <linkXRef>true</linkXRef>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <failOnViolation>true</failOnViolation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <enableRulesSummary>true</enableRulesSummary>
                    <excludes>${checkstyle.excludes}</excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>10.17.0</version>
                    </dependency>
                    <dependency>
                        <groupId>com.flowlogix</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>23</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.12</version>
                    <configuration>
                        <address>${jacocoAddress}</address>
                        <port>${jacocoPort}</port>
                        <reset>${jacocoReset}</reset>
                        <propertyName>jacocoAgent</propertyName>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <showWarnings>${compiler.show.warnings}</showWarnings>
                        <compilerArgs combine.children="append">
                            <arg>${compiler.deprecation.arg}</arg>
                            <arg>${compiler.unchecked.arg}</arg>
                            <arg>${compiler.parameters.arg}</arg>
                        </compilerArgs>
                        <proc>${compiler.annotation.processing}</proc>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <parallel>${test.parallel}</parallel>
                        <threadCount>${test.thread.count}</threadCount>
                        <runOrder>${test.run.order}</runOrder>
                        <redirectTestOutputToFile>${test.redirect.to.file}</redirectTestOutputToFile>
                        <argLine>@{jacocoAgent} @{jdk11SurefireOptions}</argLine>
                        <properties>
                            <configurationParameters>
                                junit.jupiter.execution.parallel.enabled = true
                                junit.jupiter.execution.parallel.mode.default = concurrent
                            </configurationParameters>
                        </properties>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <parallel>${it.test.parallel}</parallel>
                        <threadCount>${test.thread.count}</threadCount>
                        <runOrder>${test.run.order}</runOrder>
                        <redirectTestOutputToFile>${test.redirect.to.file}</redirectTestOutputToFile>
                        <argLine>@{jacocoAgent} @{jdk11FailsafeOptions}</argLine>
                        <systemPropertyVariables combine.children="append">
                            <arquillian.launch>${arquillian.launch}</arquillian.launch>
                            <webdriver.browser>${webdriver.browser}</webdriver.browser>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>${docs.phase}</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <sourcepath>${javadoc.sourcepath}</sourcepath>
                        <doclint>${javadoc.doclint}</doclint>
                        <additionalOptions>${javadoc.snippet.path.options}</additionalOptions>
                        <links combine.children="append">
                            <link>https://jakarta.ee/specifications/platform/${jakarta.ee.parsed.majorVersion}/apidocs</link>
                            <link>${jboss.unzip.url}/shrinkwrap/shrinkwrap-api/${shrinkwrap.api.version}/shrinkwrap-api-${shrinkwrap.api.version}-javadoc.jar-unzip</link>
                            <link>${central.archive.url}/org/projectlombok/lombok/${lombok.version}/lombok-${lombok.version}-javadoc.jar/!</link>
                        </links>
                        <notimestamp>true</notimestamp>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>${docs.phase}</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok-maven-plugin</artifactId>
                    <version>1.18.20.0</version>
                    <configuration>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                        <addOutputDirectory>false</addOutputDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>${delombok.phase}</phase>
                            <goals>
                                <goal>delombok</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <retryFailedDeploymentCount>5</retryFailedDeploymentCount>
                        <deployAtEnd>${deploy.at-end}</deployAtEnd>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <skipIfEmpty>${jar.skip-if-empty}</skipIfEmpty>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <pushChanges>false</pushChanges>
                        <localCheckout>true</localCheckout>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <preparationGoals>validate</preparationGoals>
                        <preparationProfiles>skip-checkstyle</preparationProfiles>
                        <releaseProfiles>${release.profiles},docs</releaseProfiles>
                        <tagNameFormat>Version-@{project.version}</tagNameFormat>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.simplify4u.plugins</groupId>
                    <artifactId>sign-maven-plugin</artifactId>
                    <version>1.1.0</version>
                    <configuration>
                        <serverId>${gpg.keyname}</serverId>
                        <skipNoKey>false</skipNoKey>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.cyclonedx</groupId>
                    <artifactId>cyclonedx-maven-plugin</artifactId>
                    <version>2.8.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>makeAggregateBom</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.commonjava.maven.plugins</groupId>
                    <artifactId>directory-maven-plugin</artifactId>
                    <version>1.0</version>
                    <executions>
                        <execution>
                            <id>directories</id>
                            <goals>
                                <goal>directory-of</goal>
                            </goals>
                            <phase>validate</phase>
                            <configuration>
                                <property>${base.directory.property}</property>
                                <project>
                                    <groupId>${base.directory.groupId}</groupId>
                                    <artifactId>${base.directory.artifactId}</artifactId>
                                </project>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>annotation-processing-full</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <properties>
                <compiler.annotation.processing>full</compiler.annotation.processing>
            </properties>
        </profile>
        <profile>
            <id>release-flowlogix-to-central</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.simplify4u.plugins</groupId>
                        <artifactId>sign-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.cyclonedx</groupId>
                        <artifactId>cyclonedx-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <repository>
                    <id>${staging.server}</id>
                    <url>${nexus.url}/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>release-flowlogix-to-hope</id>
            <properties>
                <staging.server>hope-nexus-artifacts</staging.server>
                <nexus.url>https://nexus.hope.nyc.ny.us</nexus.url>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.simplify4u.plugins</groupId>
                        <artifactId>sign-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.cyclonedx</groupId>
                        <artifactId>cyclonedx-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <repository>
                    <id>${staging.server}</id>
                    <url>${nexus.url}/repository/maven-releases/</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>docs</id>
            <properties>
                <docs.phase>package</docs.phase>
            </properties>
        </profile>
        <profile>
            <id>skip-checkstyle</id>
            <activation>
                <property>
                    <name>checkstyle.skip</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage-remote</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                    <goal>dump</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
