<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>au.gov.amsa</groupId>
  <artifactId>amsa-parent</artifactId>
  <version>1</version>
  <packaging>pom</packaging>
  <name>AMSA :: Parent</name>
  <description>AMSA Code Parent</description>
  <url>http://github.com/amsa-code/</url>
  <inceptionYear>2024</inceptionYear>

  <licenses>
    <license>
      <name>Apache Software License - Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>dave</id>
      <name>Dave Moten</name>
      <url>https://github.com/davidmoten/</url>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>+10</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/amsa-code/amsa-parent.git</connection>
    <developerConnection>scm:git:git@github.com:amsa-code/amsa-parent.git</developerConnection>
    <tag>amsa-parent-1</tag>
    <url>https://github.com/amsa-code/amsa-parent.git</url>
  </scm>

  <issueManagement>
    <system>github</system>
    <url>https://github.com/amsa-code/amsa-parent</url>
  </issueManagement>

  <distributionManagement>
    <repository>
      <id>oss.sonatype.org</id>
      <name>Staging Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>oss.sonatype.org</id>
      <name>Snapshot Repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <checkstyle.core.version>9.3</checkstyle.core.version>
    <checkstyle.skip>true</checkstyle.skip>
    <failIfNoTests>false</failIfNoTests>
    <forkCount>1</forkCount>
    <jdk.version.minimum>8</jdk.version.minimum>
    <maven.assembly.plugin.version>3.6.0</maven.assembly.plugin.version>
    <maven.bundle.plugin.version>5.1.9</maven.bundle.plugin.version>
    <maven.checkstyle.plugin.suppressions.xml>src/main/checkstyle/suppressions.xml</maven.checkstyle.plugin.suppressions.xml>
    <maven.checkstyle.plugin.version>3.3.1</maven.checkstyle.plugin.version>
    <maven.checkstyle.plugin.xml>src/main/checkstyle/checkstyle.xml</maven.checkstyle.plugin.xml>
    <maven.clean.plugin.version>3.3.2</maven.clean.plugin.version>
    <maven.compiler.plugin.version>3.12.1</maven.compiler.plugin.version>
    <maven.compiler.source>${jdk.version.minimum}</maven.compiler.source>
    <maven.compiler.target>${jdk.version.minimum}</maven.compiler.target>
    <maven.dependency.plugin.version>3.6.1</maven.dependency.plugin.version>
    <maven.deploy.plugin.retryFailedDeploymentCount>10</maven.deploy.plugin.retryFailedDeploymentCount>
    <maven.deploy.plugin.version>3.1.1</maven.deploy.plugin.version>
    <maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version>
    <maven.gpg.plugin.version>3.1.0</maven.gpg.plugin.version>
    <maven.info.plugin.version>3.5.0</maven.info.plugin.version>
    <maven.install.plugin.version>3.1.1</maven.install.plugin.version>
    <maven.invoker.plugin.version>3.6.0</maven.invoker.plugin.version>
    <maven.jacoco.plugin.branch.coverage>0.80</maven.jacoco.plugin.branch.coverage>
    <maven.jacoco.plugin.line.coverage>0.95</maven.jacoco.plugin.line.coverage>
    <maven.jacoco.plugin.version>0.8.11</maven.jacoco.plugin.version>
    <maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
    <maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version>
    <maven.pmd.plugin.version>3.21.2</maven.pmd.plugin.version>
    <maven.release.plugin.arguments />
    <maven.release.plugin.goals>deploy</maven.release.plugin.goals>
    <maven.release.plugin.preparationGoals>clean install</maven.release.plugin.preparationGoals>
    <maven.release.plugin.version>3.0.1</maven.release.plugin.version>
    <maven.remote.resources.plugin.version>3.1.0</maven.remote.resources.plugin.version>
    <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
    <maven.scm-publish.plugin.checkoutDirectory>${user.home}/.mvn/site/${project.artifactId}</maven.scm-publish.plugin.checkoutDirectory>
    <maven.scm-publish.plugin.tryUpdate>true</maven.scm-publish.plugin.tryUpdate>
    <maven.scm-publish.plugin.version>3.2.1</maven.scm-publish.plugin.version>
    <maven.shade.plugin.version>3.5.1</maven.shade.plugin.version>
    <maven.site.plugin.version>4.0.0-M13</maven.site.plugin.version>
    <maven.source.plugin.version>3.3.0</maven.source.plugin.version>
    <maven.spotbugs.plugin.effort>Max</maven.spotbugs.plugin.effort>
    <maven.spotbugs.plugin.threshold>Low</maven.spotbugs.plugin.threshold>
    <maven.spotbugs.plugin.version>4.8.3.0</maven.spotbugs.plugin.version>
    <maven.spotless.plugin.version>2.43.0</maven.spotless.plugin.version>
    <maven.surefire.argLine />
    <maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
    <maven.version.minimum>3.9</maven.version.minimum>
    <mavenPluginToolsVersion>3.5.2</mavenPluginToolsVersion>
    <mavenVersion>3.5.0</mavenVersion>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <surefire.timeout>3600</surefire.timeout>
  </properties>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${maven.spotless.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>${maven.spotbugs.plugin.version}</version>
          <configuration>
            <effort>${maven.spotbugs.plugin.effort}</effort>
            <threshold>${maven.spotbugs.plugin.threshold}</threshold>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>${maven.bundle.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${maven.assembly.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven.checkstyle.plugin.version}</version>
          <configuration>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <configLocation>${maven.checkstyle.plugin.xml}</configLocation>
            <encoding>UTF-8</encoding>
            <consoleOutput>true</consoleOutput>
            <failsOnError>true</failsOnError>
            <linkXRef>false</linkXRef>
            <suppressionsLocation>${maven.checkstyle.plugin.suppressions.xml}</suppressionsLocation>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.core.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven.clean.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven.compiler.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>
          <configuration>
            <retryFailedDeploymentCount>${maven.deploy.plugin.retryFailedDeploymentCount}</retryFailedDeploymentCount>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.enforcer.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven.gpg.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven.install.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>${maven.invoker.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven.jar.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven.javadoc.plugin.version}</version>
          <configuration>
            <failOnError>false</failOnError>
            <charset>UTF-8</charset>
            <docencoding>UTF-8</docencoding>
            <encoding>UTF-8</encoding>
            <docfilessubdirs>true</docfilessubdirs>
            <detectLinks>false</detectLinks>
            <detectJavaApiLink>false</detectJavaApiLink>
            <show>protected</show>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>${maven.pmd.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>${maven.info.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven.release.plugin.version}</version>
          <configuration>
            <useReleaseProfile>false</useReleaseProfile>
            <goals>${maven.release.plugin.goals}</goals>
            <arguments>-Prelease ${maven.release.plugin.arguments}</arguments>
            <preparationGoals>${maven.release.plugin.preparationGoals}</preparationGoals>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <releaseProfiles>release</releaseProfiles>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-remote-resources-plugin</artifactId>
          <version>${maven.remote.resources.plugin.version}</version>
        </plugin>
        <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-scm-publish-plugin</artifactId>
          <version>${maven.scm-publish.plugin.version}</version>
          <configuration>
            <tryUpdate>${maven.scm-publish.plugin.tryUpdate}</tryUpdate>
            <checkoutDirectory>${maven.scm-publish.plugin.checkoutDirectory}</checkoutDirectory>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven.shade.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven.site.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven.source.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
          <configuration>
            <argLine>${maven.surefire.argLine}</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${maven.jacoco.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.13</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <configuration>
          <pom>
            <includes>
              <include>pom.xml</include>
            </includes>
            <sortPom>
              <expandEmptyElements>false</expandEmptyElements>
              <nrOfIndentSpace>2</nrOfIndentSpace>
              <!-- default see https://github.com/Ekryd/sortpom/wiki/PredefinedSortOrderProfiles -->
              <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
              <!-- Sort properties -->
              <sortProperties>true</sortProperties>
              <!-- Sort modules -->
              <!--              <sortModules>true</sortModules>-->
              <!-- Sort plugin executions -->
              <sortExecutions>true</sortExecutions>
              <!-- Sort dependencies see https://github.com/Ekryd/sortpom/wiki/SortDependencies -->
              <sortDependencies>scope,groupId,artifactId</sortDependencies>
              <!-- Sort dependency exclusions -->
              <sortDependencyExclusions>groupId,artifactId</sortDependencyExclusions>
              <!-- Sort plugins: https://github.com/Ekryd/sortpom/wiki/SortPlugins -->
              <sortPlugins>groupId,artifactId</sortPlugins>
              <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
            </sortPom>
          </pom>
          <upToDateChecking>
            <enabled>true</enabled>
          </upToDateChecking>
        </configuration>
        <executions>
          <execution>
            <id>spotless-check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>validate</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <id>validate</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>validate</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-build-env</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[${maven.version.minimum},)</version>
                  <message>[ERROR] OLD MAVEN [${maven.version.minimum}] in use, ${project.artifactId} ${project.version} requires Maven ${maven.version.minimum} or newer</message>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>[${jdk.version.minimum},)</version>
                  <message>[ERROR] OLD JDK [${java.version}] in use. ${project.artifactId} ${project.version}  requires JDK ${jdk.version.minimum} or newer</message>
                </requireJavaVersion>
                <requireUpperBoundDeps />
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-descriptor</id>
            <goals>
              <goal>attach-descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <!-- configure jacoco to fail the build if not 100%
                            coverage -->
            <id>check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <rules>
                <rule>
                  <element>BUNDLE</element>
                  <limits>
                    <limit>
                      <counter>LINE</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${maven.jacoco.plugin.line.coverage}</minimum>
                    </limit>
                    <limit>
                      <counter>BRANCH</counter>
                      <value>COVEREDRATIO</value>
                      <minimum>${maven.jacoco.plugin.branch.coverage}</minimum>
                    </limit>
                  </limits>
                  <!-- <excludes> -->
                  <!-- <exclude>com.xyz.ClassToExclude</exclude> -->
                  <!-- </excludes> -->
                </rule>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>test</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <outputDirectory>${project.build.directory}/site</outputDirectory>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven.javadoc.plugin.version}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${maven.info.plugin.version}</version>
        <configuration>
          <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>jdk8</id>
      <activation>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.spotless.plugin.version>2.30.0</maven.spotless.plugin.version>
      </properties>
    </profile>
    <profile>
      <id>jdk9</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <properties>
        <maven.compiler.release>${jdk.version.minimum}</maven.compiler.release>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <configuration>
                <additionalOptions>
                  <additionalOption>-html5</additionalOption>
                </additionalOptions>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <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>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
