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

    <groupId>io.github.stevecrox</groupId>
    <artifactId>maven-parent</artifactId>
    <version>1.0.4</version>
    <packaging>pom</packaging>

    <name>Maven Parent</name>
    <description>SUPER POM to simplify development of Maven based projects.</description>
    <url>https://stevecrox.github.io/maven-parent/</url>
    <inceptionYear>2022</inceptionYear>

    <ciManagement>
        <system>GitHub</system>
        <url>https://github.com/${github_organisation}/${github_repository_name}/actions</url>
    </ciManagement>

    <scm>
        <connection>scm:git:https://github.com/${github_organisation}/${github_repository_name}.git</connection>
        <developerConnection>scm:git:https://github.com/${github_organisation}/${github_repository_name}.git</developerConnection>
        <url>https://github.com/${github_organisation}/${github_repository_name}</url>
        <tag>v1.0.4</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/${github_organisation}/${github_repository_name}/issues</url>
    </issueManagement>

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

    <developers>
        <developer>
            <name>Stephen Crocker</name>
            <email>stevecrox AT hotmail DOT com DOT br</email>
        </developer>
    </developers>

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

    <properties>
        <!-- Name of the projects to use as part of the site description. -->
        <github_repository_name>maven-parent</github_repository_name>
        <github_organisation>stevecrox</github_organisation>

        <!-- Project documentation. -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.targetEncoding>ISO-8859-1</project.build.targetEncoding>

        <!-- Compiler settings, lets you tweak what JDK you are using as needed. -->
        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.failOnError>true</maven.compiler.failOnError>
        <maven.compiler.failOnWarning>false</maven.compiler.failOnWarning>
        <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
        <maven.compiler.showWarnings>true</maven.compiler.showWarnings>

        <!-- Used to get the Site files into the right structure, while also being readable in an SCM. -->
        <project.docs.directory>docs</project.docs.directory>
        <project.build.interim.site.directory>${project.build.directory}/docs-site</project.build.interim.site.directory>

        <!-- Used to publish the maven site. -->
        <scmpublish.scm.branch>gh-pages</scmpublish.scm.branch>
        <scmpublish.pubScmUrl>${project.scm.connection}</scmpublish.pubScmUrl>
        <scmpublish.content>${project.build.directory}/staging</scmpublish.content>
        <!-- GitHub Changelog Parameters -->
        <displayFileRevDetailUrl>${project.scm.url}/tree/master/%FILE%</displayFileRevDetailUrl>
        <displayChangeSetDetailUrl>${project.scm.url}/commit</displayChangeSetDetailUrl>

        <!-- Apache Maven Build Plugin Versions. -->
        <maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
        <maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>
        <maven-deploy-plugin.version>3.1.0</maven-deploy-plugin.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>

        <!-- Apache Maven Test Plugin Versions. -->
        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M9</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.0.0-M9</maven-failsafe-plugin.version>
        <!-- Jacoco Settings. -->
        <argLine />

        <!-- Apache Maven Release Plugin Versions. -->
        <checksum-maven-plugin.version>1.11</checksum-maven-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <maven-release-plugin.version>3.0.0-M7</maven-release-plugin.version>
        <releaseVersion />

        <!-- Apache Maven Reporting Plugin Versions. -->
        <maven-site-plugin.version>4.0.0-M5</maven-site-plugin.version>
        <maven-project-info-reports-plugin.version>3.4.2</maven-project-info-reports-plugin.version>
        <maven-scm-publish-plugin.version>3.1.0</maven-scm-publish-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-changelog-plugin.version>2.3</maven-changelog-plugin.version>
        <maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
        <maven-jxr-plugin.version>3.3.0</maven-jxr-plugin.version>
        <maven-surefire-report-plugin.version>3.0.0-M9</maven-surefire-report-plugin.version>
        <taglist-maven-plugin.version>3.0.0</taglist-maven-plugin.version>
        <maven-pmd-plugin.version>3.20.0</maven-pmd-plugin.version>
        <sonar-maven-plugin.version>5.1</sonar-maven-plugin.version>

        <!-- Spotbugs specific configuration. -->
        <spotbugs-maven-plugin.version>4.7.3.2</spotbugs-maven-plugin.version>
        <spotbugs.xmlOutput>true</spotbugs.xmlOutput>
        <spotbugs.effort>Max</spotbugs.effort>
        <spotbugs.skipEmptyReport>true</spotbugs.skipEmptyReport>
        <spotbugs.threshold>Low</spotbugs.threshold>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <!-- Added to stop the compiler from including build artifacts/project data. -->
                        <excludes>
                            <exclude>**/bin/**/*.*</exclude>
                            <exclude>**/.settings/**/*.*</exclude>
                            <exclude>**/target/**/*.*</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <!-- Apache Maven Build Plugin Versions. -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <configuration>
                        <skipIfEmpty>true</skipIfEmpty>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>

                <!-- Apache Maven Test Plugin Versions. -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>@{argLine} --illegal-access=permit</argLine>
                        <parallel>methods</parallel>
                        <threadCount>10</threadCount>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <argLine>@{argLine} --illegal-access=permit</argLine>
                        <parallel>suites</parallel>
                        <threadCount>1</threadCount>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>jacoco-initialize</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>jacoco-site</id>
                            <phase>package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Apache Maven Release Plugin Definitions. -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <configuration>
                        <gpgArguments>
                            <arg>--pinentry-mode</arg>
                            <arg>loopback</arg>
                        </gpgArguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.nicoulaj.maven.plugins</groupId>
                    <artifactId>checksum-maven-plugin</artifactId>
                    <version>${checksum-maven-plugin.version}</version>
                    <configuration>
                        <algorithms>
                            <algorithm>MD5</algorithm>
                            <algorithm>SHA-512</algorithm>
                        </algorithms>
                        <attachChecksums>true</attachChecksums>
                        <includeClassifiers>source-release</includeClassifiers>
                        <excludeMainArtifact>false</excludeMainArtifact>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>v${releaseVersion}</tagNameFormat>
                    </configuration>
                </plugin>

                <!-- Apache Maven Reporting Plugin Definitions. -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                    <configuration>
                        <pomPackagingOnly>false</pomPackagingOnly>
                        <topSiteURL>${project.url}</topSiteURL>
                        <workingDirectory>${project.build.interim.site.directory}</workingDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-descriptor</id>
                            <goals>
                                <goal>attach-descriptor</goal>
                            </goals>
                            <phase>post-integration-test</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-scm-publish-plugin</artifactId>
                    <version>${maven-scm-publish-plugin.version}</version>
                    <configuration>
                        <checkinComment>Updating Site documentation</checkinComment>
                        <serverId>site</serverId>
                    </configuration>
                </plugin>

                <!-- Maven Reporting Plugin. -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>${maven-project-info-reports-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-changelog-plugin</artifactId>
                    <version>${maven-changelog-plugin.version}</version>
                    <configuration>
                        <displayFileRevDetailUrl>${project.scm.url}/tree/master/%FILE%</displayFileRevDetailUrl>
                        <displayChangeSetDetailUrl>${project.scm.url}/commit</displayChangeSetDetailUrl>
                        <headingDateFormat>MM-dd-yyyy</headingDateFormat>
                        <outputEncoding>${project.build.sourceEncoding}</outputEncoding>
                        <type>range</type>
                        <range>30</range>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>${maven-surefire-report-plugin.version}</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <alwaysGenerateSurefireReport>true</alwaysGenerateSurefireReport>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>taglist-maven-plugin</artifactId>
                    <version>${taglist-maven-plugin.version}</version>
                    <configuration>
                        <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
                        <sourceFileLocale>en</sourceFileLocale>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <version>${maven-jxr-plugin.version}</version>
                    <configuration>
                        <inputEncoding>${project.build.sourceEncoding}</inputEncoding>
                        <outputEncoding>${project.build.targetEncoding}</outputEncoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${spotbugs-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${maven-pmd-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${maven-pmd-plugin.version}</version>
                <configuration>
                    <minimumPriority>10</minimumPriority>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
            </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-changelog-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>documentation</id>
            <activation>
                <file>
                    <exists>src/main/java</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
        <profile>
            <id>docs-documentation</id>
            <activation>
                <file>
                    <exists>docs</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-markdown-into-target</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${project.docs.directory}/</directory>
                                            <includes>
                                                <include>**/*.md</include>
                                            </includes>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${project.build.interim.site.directory}/markdown/</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-resources-into-target</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${project.docs.directory}/</directory>
                                            <excludes>
                                                <exclude>**/*.md</exclude>
                                                <exclude>site.xml</exclude>
                                            </excludes>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${project.build.interim.site.directory}/resources/</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-sitexml-into-target</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${project.docs.directory}/</directory>
                                            <includes>
                                                <include>site.xml</include>
                                            </includes>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${project.build.interim.site.directory}/</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-site-resources-into-target</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>src/site</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${project.build.interim.site.directory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <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>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.nicoulaj.maven.plugins</groupId>
                        <artifactId>checksum-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>source-release-checksum</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>artifacts</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
