<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>com.spt-development</groupId>
    <artifactId>spt-development-test</artifactId>
    <version>3.1.19</version>

    <name>test</name>
    <description>A collection of utility classes useful for unit and integration testing.</description>
    <url>https://github.com/spt-development/spt-development-test</url>

    <scm>
        <connection>scm:git:https://github.com/spt-development/spt-development-test.git</connection>
        <url>https://github.com/spt-development/spt-development-test</url>
    <tag>3.1.19</tag>
  </scm>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.compiler.release>17</maven.compiler.release>

        <!-- Maven version -->
        <maven.min.version>3.9.4</maven.min.version>

	    <!-- Dependency versions -->
        <commons-io.version>2.19.0</commons-io.version>
        <greenmail.version>2.1.3</greenmail.version>

        <!-- Dependency versions, matched to Spring Boot -->
        <commons-lang.version>3.17.0</commons-lang.version>
        <hamcrest.version>3.0</hamcrest.version>
        <httpcore5.version>5.3.4</httpcore5.version>
        <httpclient5.version>5.5</httpclient5.version>
        <jakarta-jms.version>3.1.0</jakarta-jms.version>
        <junit-jupiter.version>5.12.2</junit-jupiter.version>
        <logback.version>1.5.18</logback.version>
        <mockito.version>5.17.0</mockito.version>
        <slf4j.version>2.0.17</slf4j.version>
        <spring.version>6.2.8</spring.version>

        <!-- Plugin versions -->
        <build-helper-maven-plugin.version>3.6.1</build-helper-maven-plugin.version>
        <central-publishing-plugin.version>0.8.0</central-publishing-plugin.version>
        <checkstyle-maven-plugin.version>3.6.0</checkstyle-maven-plugin.version>
        <dependency-check-maven.version>12.1.3</dependency-check-maven.version>
        <license-maven-plugin.version>2.6.0</license-maven-plugin.version>
        <maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
        <maven-enforcer-plugin.version>3.6.0</maven-enforcer-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-jxr-plugin.version>3.6.0</maven-jxr-plugin.version>
        <maven-pmd-plugin.version>3.27.0</maven-pmd-plugin.version>
        <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
        <maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <spotbugs.version>4.9.3.2</spotbugs.version>
        <versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>

        <!-- Plugin dependencies -->
        <checkstyle.version>10.26.1</checkstyle.version>
        <findbugs-slf4j-bug-pattern.version>1.5.0</findbugs-slf4j-bug-pattern.version>
        <findbugs-sec-bug-pattern.version>1.14.0</findbugs-sec-bug-pattern.version>
        <pmd.version>7.15.0</pmd.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- BOMs -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit-jupiter.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Third-party dependencies added to avoid dependency convergence errors -->
            <dependency>
                <groupId>org.apache.httpcomponents.core5</groupId>
                <artifactId>httpcore5</artifactId>
                <version>${httpcore5.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Third-party dependencies -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>com.icegreen</groupId>
            <artifactId>greenmail</artifactId>
            <version>${greenmail.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
            <version>${jakarta-jms.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents.client5</groupId>
            <artifactId>httpclient5</artifactId>
            <version>${httpclient5.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents.core5</groupId>
            <artifactId>httpcore5</artifactId>
            <!-- Version defined in dependencyManagement section -->
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>${hamcrest.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <!-- Version defined in junit bom, imported in dependencyManagement section -->
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <!-- Version defined in dependencyManagement section -->
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <!-- Version defined in spring framework bom, imported in dependencyManagement section -->
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Plugins used in custom profiles, added so that new versions are detected by the versions plugin -->
                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${maven-pmd-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-core</artifactId>
                            <version>${pmd.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-java</artifactId>
                            <version>${pmd.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-javascript</artifactId>
                            <version>${pmd.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-jsp</artifactId>
                            <version>${pmd.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${central-publishing-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>parse-version</id>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                        <arg>-Xlint:-processing</arg>
                        <arg>-Werror</arg>
                    </compilerArgs>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <!--
                                 Disable test compilation as there are no tests, Since maven-compiler-plugin 3.12.0, compiling when there are no tests has caused the following
                                 error:

                                 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.0:testCompile (default-testCompile) on project <project>: Fatal error
                                 compiling: basedir <baseDir>/target/generated-test-sources/test-annotations does not exist
                              -->
                            <!-- There are no tests to compile -->
                            <skip>false</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${maven-dependency-plugin.version}</version>
                <executions>
                    <execution>
                        <id>analyze</id>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                            <ignoreNonCompile>true</ignoreNonCompile>
                            <ignoreAllNonTestScoped>true</ignoreAllNonTestScoped>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <dependencyConvergence />
                                <requireFilesExist>
                                    <files>
                                        <!-- Minimum set of documentation required -->
                                        <file>${project.basedir}/README.md</file>
                                        <file>${project.basedir}/documentation/releases/release-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.md</file>
                                    </files>
                                </requireFilesExist>
                                <requireMavenVersion>
                                    <version>${maven.min.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle-maven-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <violationSeverity>warning</violationSeverity>
                </configuration>
                <executions>
                    <execution>
                        <id>google-checks</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <configLocation>google_checks.xml</configLocation>
                            <suppressionsLocation>config/checkstyle/google_checks_suppressions.xml</suppressionsLocation>
                        </configuration>
                    </execution>
                    <execution>
                        <id>spt-checks</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <configLocation>config/checkstyle/spt_checks.xml</configLocation>
                            <suppressionsLocation>config/checkstyle/spt_checks_suppressions.xml</suppressionsLocation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs.version}</version>
                <dependencies>
                    <!--
                         Added slf4j dependencies to resolve warning:

                         SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
                         ...
                      -->
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>${slf4j.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-simple</artifactId>
                        <version>${slf4j.version}</version>
                    </dependency>

                    <!-- Included as dependencies as well as plugins so that versions plugins picks up new versions -->
                    <dependency>
                        <groupId>jp.skypencil.findbugs.slf4j</groupId>
                        <artifactId>bug-pattern</artifactId>
                        <version>${findbugs-slf4j-bug-pattern.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.h3xstream.findsecbugs</groupId>
                        <artifactId>findsecbugs-plugin</artifactId>
                        <version>${findbugs-sec-bug-pattern.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Low</threshold>
                    <xmlOutput>false</xmlOutput>
                    <plugins>
                        <plugin>
                            <groupId>jp.skypencil.findbugs.slf4j</groupId>
                            <artifactId>bug-pattern</artifactId>
                            <version>${findbugs-slf4j-bug-pattern.version}</version>
                        </plugin>
                        <plugin>
                            <groupId>com.h3xstream.findsecbugs</groupId>
                            <artifactId>findsecbugs-plugin</artifactId>
                            <version>${findbugs-sec-bug-pattern.version}</version>
                        </plugin>
                    </plugins>
                    <excludeFilterFile>${project.basedir}/config/findbugs/findbugs-exclude.xml</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>${dependency-check-maven.version}</version>
                <configuration>
                    <!-- Assembly analyzer disabled because we don't have any .NET code/dlls -->
                    <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                    <!-- Node and retirejs analyzer disabled, because any js floating around isn't part of the main app -->
                    <nodeAnalyzerEnabled>false</nodeAnalyzerEnabled>

                    <failBuildOnCVSS>0</failBuildOnCVSS>
                    <suppressionFiles>
                        <suppressionFile>${project.basedir}/config/owasp/suppress.xml</suppressionFile>
                    </suppressionFiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <configuration>
                    <outputFile>${project.build.directory}/dependency-versions.txt</outputFile>
                    <rulesUri>file:///${project.basedir}/config/versions/version-rules.xml</rulesUri>
                </configuration>
                <version>${versions-maven-plugin.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-scm-plugin</artifactId>
                <version>${maven-scm-plugin.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                    <goals>deploy</goals>
                    <scmCommentPrefix>[skip ci] [maven-release-plugin] </scmCommentPrefix>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <!-- Additional quality gates not run by default when executing mvn clean verify, but are run by CI pipeline -->
            <id>all-quality-gates</id>
            <build>
                <plugins>
                    <!-- NOTE. As this is a test project, only performing PMD test checks -->
                    <plugin>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <configuration>
                            <includeTests>false</includeTests>
                            <printFailingErrors>true</printFailingErrors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>pmd-test-check</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>pmd</goal>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <targetDirectory>${project.build.directory}/pmdTest/</targetDirectory>
                                    <includeTests>true</includeTests>
                                    <excludeRoots>
                                        <excludeRoot>${basedir}/src/main/java</excludeRoot>
                                    </excludeRoots>
                                    <rulesets>
                                        <ruleset>config/pmd/rulesets/spt-default-rules.xml</ruleset>
                                        <ruleset>config/pmd/rulesets/spt-test-rules.xml</ruleset>
                                    </rulesets>
                                </configuration>
                            </execution>
                            <execution>
                                <id>cpd-check</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>cpd-check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>add-third-party</goal>
                                </goals>
                                <configuration>
                                    <failOnBlacklist>true</failOnBlacklist>
                                    <licenseMerges>
                                        <!-- Aggregate different ways to write acceptable licenses -->
                                        <licenseMerge>CC0 1.0 Universal (CC0 1.0) Public Domain Dedication|
                                            Public Domain, per Creative Commons CC0
                                        </licenseMerge>
                                        <licenseMerge>Eclipse Distribution License - v1.0|
                                            Eclipse Distribution License - v 1.0
                                        </licenseMerge>
                                        <licenseMerge>Eclipse Public License - v1.0|
                                            Eclipse Public License 1.0|Eclipse Public License - v 1.0|EDL 1.0
                                        </licenseMerge>
                                        <licenseMerge>Eclipse Public License - v2.0|
                                            Eclipse Public License 2.0|Eclipse Public License v2.0|EPL 2.0|
                                            Eclipse Public License - v 2.0
                                        </licenseMerge>
                                        <licenseMerge>The 2-Clause BSD License|BSD-2-Clause
                                        </licenseMerge>
                                        <licenseMerge>The 3-Clause BSD License|BSD License 3|BSD-3-Clause
                                        </licenseMerge>
                                        <licenseMerge>The Apache Software License, Version 2.0|Apache2|
                                            Apache-2.0|Apache 2|APL2|Apache 2.0|Apache License, Version 2.0|
                                            The Apache License, Version 2.0|Apache Software License - Version 2.0|
                                            the Apache License, ASL Version 2.0|ASL 2.0|Apache License 2.0|ASL, version 2
                                        </licenseMerge>
                                        <licenseMerge>The MIT License|
                                            MIT license|The MIT License (MIT)|MIT License|MIT|MIT-style
                                        </licenseMerge>
                                    </licenseMerges>
                                    <includedLicenses>
                                        <!-- To get an idea of risk, see - https://www.synopsys.com/blogs/software-security/top-open-source-licenses/ -->
                                        <includedLicense>CC0 1.0 Universal (CC0 1.0) Public Domain Dedication</includedLicense>
                                        <includedLicense>Eclipse Distribution License - v1.0</includedLicense>
                                        <includedLicense>Eclipse Public License - v1.0</includedLicense>
                                        <includedLicense>Eclipse Public License - v2.0</includedLicense>
                                        <includedLicense>The 2-Clause BSD License</includedLicense>
                                        <includedLicense>The 3-Clause BSD License</includedLicense>
                                        <includedLicense>The Apache Software License, Version 2.0</includedLicense>
                                        <includedLicense>The MIT License</includedLicense>
                                    </includedLicenses>
                                </configuration>
                            </execution>
                        </executions>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                        <!-- Version defined in pluginManagement section -->
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>${maven-jxr-plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <developers>
        <developer>
            <name>Simon Taylor</name>
            <email>simon.taylor@spt-development.com</email>
            <organizationUrl>http://www.spt-development.com</organizationUrl>
        </developer>
    </developers>

    <distributionManagement>
        <site>
            <id>github</id>
            <url>https://github.com/spt-development/spt-development-test</url>
        </site>
    </distributionManagement>
</project>
