<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2023 Adrian Herscu
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- see
    https://central.sonatype.org/publish/requirements/
    https://central.sonatype.org/publish/publish-guide/
    https://central.sonatype.org/publish/publish-maven/
    -->

  <groupId>dev.aherscu.qa</groupId>
  <artifactId>qa-automation</artifactId>
  <version>0.0.21</version>
  <packaging>pom</packaging>

  <name>QA Automation</name>
  <description>Support for BDD-style QA automation.
    Generates skeleton project with all required dependencies, preconfigured
    loggers, execution profiles for different environments and devices.
    Compatible with Java 8 and Java 11 and beyond.
  </description>
  <url>https://qa-automation-starter.aherscu.dev/</url>

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

  <developers>
    <developer>
      <name>Adrian Herscu</name>
      <email>adrian.herscu@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <connection>
      scm:git:https://github.com/QA-Automation-Starter/qa-automation.git
    </connection>
    <developerConnection>
      scm:git:ssh://git@github.com/QA-Automation-Starter/qa-automation.git
    </developerConnection>
    <url>https://github.com/QA-Automation-Starter/qa-automation</url>
    <tag>qa-automation-0.0.21</tag>
  </scm>

  <modules>
    <module>qa-tester-utils</module>
    <module>qa-jgiven-reporter</module>
    <module>qa-jgiven-reporter-maven-plugin</module>
    <module>qa-orcanos-publisher-maven-plugin</module>
    <module>qa-s3-uploader-maven-plugin</module>
    <module>qa-jgiven-commons</module>
    <module>qa-testing-parent</module>
    <module>qa-testing-example</module>
    <module>qa-testing-archetype</module>
  </modules>

  <properties>
    <!-- IMPORTANT: do not override version properties in child projects;
      this may lead to having different versions of same library -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <delombok.directory>${project.build.directory}/delombok</delombok.directory>
    <!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=552687 -->
    <!-- see https://github.com/eclipse/org.aspectj/blob/master/docs/dist/doc/JavaVersionCompatibility.md -->
    <aspectj.version>1.9.7</aspectj.version>
    <aspectj.showWeaveInfo>true</aspectj.showWeaveInfo>
    <aspectj.verbose>true</aspectj.verbose>
    <!-- NOTE: currently supported 1.8 and 11+; specified via profiles -->
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.compiler.xlint>all</maven.compiler.xlint>
    <jgiven.version>1.1.0</jgiven.version>
    <jersey.version>2.31</jersey.version>
    <slf4j.version>1.7.30</slf4j.version>
    <log.root.level>info</log.root.level>
    <connection.mstimeout>30000</connection.mstimeout>
    <read.mstimeout>30000</read.mstimeout>
    <test.properties.file>test.properties</test.properties.file>
    <surefire.suiteXmlFiles>testng.xml</surefire.suiteXmlFiles>
    <surefire.version>3.0.0-M3</surefire.version>
    <maven.version>3.6.1</maven.version>
    <!-- NOTE: may cause the console logs to blow out -->
    <jgiven.report.text>true</jgiven.report.text>
    <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
  </properties>

  <repositories>
    <repository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <distributionManagement>
    <site>
      <id>github</id>
      <!-- NOTE: publish Maven site using:
          mvnw clean site site:stage scm-publish:publish-scm
          then, the site will appear at:
          https://qa-automation-starter.github.io/qa-automation/
          -->
      <url>
        scm:git:ssh://git@github.com/QA-Automation-Starter/qa-automation.git
      </url>
    </site>
    <repository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
      </url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>${aspectj.version}</version>
      </dependency>
      <!-- NOTE: using compile-time weaving -->
      <!--dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>${aspectj.version}</version>
      </dependency-->
      <dependency>
        <groupId>com.tngtech.jgiven</groupId>
        <artifactId>jgiven-html5-report</artifactId>
        <version>${jgiven.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.4.0</version>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.20</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>2.0.1.Final</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>3.0.1</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.3</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <defaultGoal>install</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-publish-plugin</artifactId>
          <version>3.1.0</version>
          <configuration>
            <!-- ISSUE fails displaying JGiven thumbnails and attachments
              although these appear on gh-pages branch;
              see https://github.com/QA-Automation-Starter/qa-automation/tree/gh-pages/qa-testing-parent/qa-testing-example/jgiven-reports/functional-default/runneradmin%40local-20221026081309/html/data/attachments/dev/aherscu/qa/testing/example/scenarios/tutorial/_9_TestingGoogleWithJGiven

              But when opened in a Web Browser, this results in 404:
              and https://qa-automation-starter.github.io/qa-automation/qa-testing-parent/qa-testing-example/jgiven-reports/functional-default/runneradmin@local-20221026081309/html/data/attachments/dev/aherscu/qa/testing/example/scenarios/tutorial/_9_TestingGoogleWithJGiven/attachment2.png

              Both subpaths appear identical:
              qa-testing-parent/qa-testing-example/jgiven-reports/functional-default/runneradmin@local-20221026081309/html/data/attachments/dev/aherscu/qa/testing/example/scenarios/tutorial/_9_TestingGoogleWithJGiven
              qa-testing-parent/qa-testing-example/jgiven-reports/functional-default/runneradmin@local-20221026081309/html/data/attachments/dev/aherscu/qa/testing/example/scenarios/tutorial/_9_TestingGoogleWithJGiven/attachment2.png

              Same thing happens locally under Windows with the _staging_ directory:
              file:///C:/projects/qa-automation/target/staging/qa-testing-parent/qa-testing-example/jgiven-reports/functional-default/adrian@local-20221026075408/html/index.html#/all?status=success
              -->
            <scmBranch>gh-pages</scmBranch>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.0.0-M6</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <useReleaseProfile>false</useReleaseProfile>
            <goals>deploy</goals>
            <!-- NOTE: during release:prepare, the main branch is committed
              with the bumped-up project version; in order to prevent
              a CI build from being triggered we add [skip ci] here -->
            <scmCommentPrefix>[skip ci][maven-release-plugin]</scmCommentPrefix>
            <!-- NOTE: after commiting the development version we want a CI
              build in order to have the new snapshots deployed -->
            <scmDevelopmentCommitComment>[maven-release-plugin]
            </scmDevelopmentCommitComment>
            <!-- NOTE: during release:prepare the generated project
              refers to yet not released parent version hence failing
              to pass integration test.
              All tests are redundant since the project should
              install correctly before trying to release it. -->
            <arguments>-Darchetype.test.skip -DskipTests -DskipITs</arguments>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>

        <!-- ISSUE: fixing the javadocs is too slow and generates lots of errors;
          disable javadoc lint -->
        <!--plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.4.0</version>
          <configuration>
            <defaultVersion>${project.version}</defaultVersion>
            <defaultAuthor>Adrian Herscu</defaultAuthor>
            <force>true</force>
          </configuration>
        </plugin-->

        <plugin>
          <groupId>net.revelc.code.formatter</groupId>
          <artifactId>formatter-maven-plugin</artifactId>
          <version>2.8.1</version>
          <configuration>
            <configFile>${project.basedir}/code-formatter-rules.xml</configFile>
            <directories>
              <directory>${project.build.sourceDirectory}</directory>
              <directory>${delombok.directory}</directory>
            </directories>
          </configuration>
          <executions>
            <execution>
              <goals>
                <!-- runs at process-sources phase by default -->
                <goal>format</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>net.revelc.code</groupId>
          <artifactId>impsort-maven-plugin</artifactId>
          <version>1.5.0</version>
          <configuration>
            <groups>java.,javax.,org.,com.,*</groups>
            <removeUnused>true</removeUnused>
            <directories>
              <directory>${project.build.sourceDirectory}</directory>
              <directory>${delombok.directory}</directory>
            </directories>
          </configuration>
          <executions>
            <execution>
              <id>sort-imports</id>
              <goals>
                <!-- runs at process-sources phase by default -->
                <goal>sort</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!-- required to support jdk 11+ -->
          <!-- see https://github.com/mojohaus/aspectj-maven-plugin/pull/45 -->
          <!-- see also https://github.com/mojohaus/aspectj-maven-plugin/issues/52 -->
          <!-- see https://github.com/dev-aspectj/aspectj-maven-plugin#history -->
          <!-- ISSUE (re-)importing a maven project into intellij turns off aspectj post compile mode
            see https://stackoverflow.com/questions/75142147/re-importing-a-maven-project-into-intellij-turns-off-aspectj-post-compile-mode -->
          <groupId>dev.aspectj</groupId>
          <artifactId>aspectj-maven-plugin</artifactId>
          <version>1.13.1</version>
          <dependencies>
            <dependency>
              <groupId>org.aspectj</groupId>
              <artifactId>aspectjtools</artifactId>
              <version>${aspectj.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <complianceLevel>${java.version}</complianceLevel>
            <source>${java.version}</source>
            <target>${java.version}</target>
            <showWeaveInfo>${aspectj.showWeaveInfo}</showWeaveInfo>
            <sources />
            <testSources />
            <verbose>${aspectj.verbose}</verbose>
            <Xlint>ignore</Xlint>
            <!-- NOTE: Lombok requires compilation via javac,
            hence this one is required too, otherwise aspects will not weave -->
            <forceAjcCompile>true</forceAjcCompile>
          </configuration>
          <executions>
            <execution>
              <id>weave-application-classes</id>
              <phase>process-classes</phase>
              <goals>
                <goal>compile</goal>
              </goals>
              <configuration>
                <!-- NOTE: required in order to work with Lombok -->
                <weaveDirectories>
                  <weaveDirectory>${project.build.directory}/classes
                  </weaveDirectory>
                </weaveDirectories>
              </configuration>
            </execution>
            <execution>
              <id>weave-test-classes</id>
              <phase>process-test-classes</phase>
              <goals>
                <goal>test-compile</goal>
              </goals>
              <configuration>
                <!-- NOTE: required in order to work with Lombok -->
                <weaveDirectories>
                  <weaveDirectory>${project.build.directory}/test-classes
                  </weaveDirectory>
                </weaveDirectories>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <!-- ISSUE https://github.com/projectlombok/lombok/issues/2839 -->
          <configuration>
            <compilerArgs>
              <arg>-Xlint:${maven.compiler.xlint}</arg>
            </compilerArgs>
            <annotationProcessorPaths>
              <path>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.20</version>
              </path>
            </annotationProcessorPaths>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <!--version>3.0.0-M5</version-->
          <!--
            [WARNING] Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin
            java.lang.NoClassDefFoundError: org/apache/maven/surefire/api/testset/TestSetFailedException
            seems to fail when used for testing Maven plugins -->
          <version>${surefire.version}</version>
          <configuration>
            <systemPropertyVariables>
              <log.root.level>${log.root.level}</log.root.level>
              <test.properties.file>${test.properties.file}
              </test.properties.file>
              <!-- NOTE: on *nix systems the Oracle Database driver gets a
                "connect reset" socket exception while trying to establish an SSL connection.
                This happens due to the way the random number generator is seeded on *nix
                systems. This switch forces the JVM to use an unblocking source of randomness.
                see http://bugs.java.com/view_bug.do?bug_id=4705093 and https://bugs.openjdk.java.net/browse/JDK-4705093
                and https://bugs.openjdk.java.net/browse/JDK-6366924 and https://community.oracle.com/message/3701989/ -->
              <java.security.egd>file:///dev/urandom</java.security.egd>
              <sun.net.client.defaultConnectTimeout>30000
              </sun.net.client.defaultConnectTimeout>
              <sun.net.client.defaultReadTimeout>30000
              </sun.net.client.defaultReadTimeout>
              <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
              <jgiven.report.text>${jgiven.report.text}</jgiven.report.text>
              <testng.dtd.http>false</testng.dtd.http>
            </systemPropertyVariables>
            <argLine>-noverify -Dfile.encoding=${project.build.sourceEncoding}
            </argLine>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${surefire.version}</version>
          <configuration>
            <systemPropertyVariables>
              <log.root.level>${log.root.level}</log.root.level>
              <test.properties.file>${test.properties.file}
              </test.properties.file>
              <!-- NOTE: on *nix systems the Oracle Database driver gets a
                "connect reset" socket exception while trying to establish an SSL connection.
                This happens due to the way the random number generator is seeded on *nix
                systems. This switch forces the JVM to use an unblocking source of randomness.
                see http://bugs.java.com/view_bug.do?bug_id=4705093 and https://bugs.openjdk.java.net/browse/JDK-4705093
                and https://bugs.openjdk.java.net/browse/JDK-6366924 and https://community.oracle.com/message/3701989/ -->
              <java.security.egd>file:///dev/urandom</java.security.egd>
              <sun.net.client.defaultConnectTimeout>${connection.mstimeout}
              </sun.net.client.defaultConnectTimeout>
              <sun.net.client.defaultReadTimeout>${read.mstimeout}
              </sun.net.client.defaultReadTimeout>
              <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
              <jgiven.report.text>${jgiven.report.text}</jgiven.report.text>
              <testng.dtd.http>false</testng.dtd.http>
            </systemPropertyVariables>
            <argLine>-noverify -Dfile.encoding=${project.build.sourceEncoding}
            </argLine>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.tngtech.jgiven</groupId>
          <artifactId>jgiven-maven-plugin</artifactId>
          <version>${jgiven.version}</version>
          <dependencies>
            <!-- NOTE: log to stderr-->
            <dependency>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-simple</artifactId>
              <version>1.7.13</version>
            </dependency>
          </dependencies>
          <!-- executions>
            <execution>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
          </executions-->
          <configuration>
            <format>html5</format>
          </configuration>
        </plugin>

        <!-- see https://stackoverflow.com/questions/52362413/create-and-install-de-lomboked-source-jar-in-maven -->
        <plugin>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok-maven-plugin</artifactId>
          <version>1.18.20.0</version>
          <executions>
            <execution>
              <id>delombok-sources</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>delombok</goal>
              </goals>
              <configuration>
                <sourceDirectory>${project.build.sourceDirectory}
                </sourceDirectory>
                <outputDirectory>${delombok.directory}</outputDirectory>
                <addOutputDirectory>false</addOutputDirectory>
                <formatPreferences>
                  <indent>4</indent>
                </formatPreferences>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!-- NOTE have to package de-lomboked code,
            otherwise the attached sources JAR will not match their bytecode -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>generate-delomboked-sources-jar</id>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <target>
                  <jar destfile="${project.build.directory}/${project.build.finalName}-sources.jar" basedir="${delombok.directory}" />
                </target>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!-- NOTE have to attach de-lomboked sources,
            otherwise the attached sources JAR will not match their bytecode -->
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.3.0</version>
          <executions>
            <execution>
              <id>attach-delomboked-sources-jar</id>
              <phase>package</phase>
              <goals>
                <goal>attach-artifact</goal>
              </goals>
              <configuration>
                <artifacts>
                  <artifact>
                    <file>
                      ${project.build.directory}/${project.build.finalName}-sources.jar
                    </file>
                    <type>jar</type>
                    <classifier>sources</classifier>
                  </artifact>
                </artifacts>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- NOTE: configured according to following guides
      https://central.sonatype.org/publish/publish-guide/
      https://maven.apache.org/repository/guide-central-repository-upload.html
      https://theoverengineered.blog/posts/publishing-my-first-artifact-to-maven-central-using-github-actions
      https://dzone.com/articles/deploy-maven-central
      -->
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.13</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.4.0</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <doclint>none</doclint>
          <quiet>true</quiet>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-help-plugin</artifactId>
        <version>3.2.0</version>
        <!-- ISSUE: too much noise when configured as below -->
        <!--        <executions>-->
        <!--          <execution>-->
        <!--            <id>show-profiles</id>-->
        <!--            <phase>initialize</phase>-->
        <!--            <goals>-->
        <!--              <goal>active-profiles</goal>-->
        <!--            </goals>-->
        <!--          </execution>-->
        <!--        </executions>-->
      </plugin>

      <plugin>
        <!-- NOTE enforce Java runtime version for Maven -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[${java.version},)</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>[3.6,)</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.4.2.1</version>
        <configuration>
          <effort>Max</effort>
          <failOnError>false</failOnError>
          <threshold>Low</threshold>
          <xmlOutput>true</xmlOutput>
          <spotbugsXmlOutputDirectory>${project.build.directory}/findbugs
          </spotbugsXmlOutputDirectory>
          <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
        </configuration>
        <executions>
          <execution>
            <id>analyze-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.12.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.4.1</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>platform-jdk8</id>
      <activation>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <java.version>1.8</java.version>
      </properties>
    </profile>

    <profile>
      <!-- on JDKs from version 11 onwards, compile as Java 11 -->
      <id>platform-jdk11</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <properties>
        <java.version>11</java.version>
        <aspectj.version>1.9.9.1</aspectj.version>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <!-- ISSUE not all Java libraries are module aware,
          hence the Javadoc tool fails
          - deployment to Maven Central requires Javadoc artifact -->
        <maven.javadoc.skip>true</maven.javadoc.skip>
        <maven.deploy.skip>true</maven.deploy.skip>
        <!-- ISSUE Maven Archetype integration tests run with JDK 8
          further failing due to class version -->
        <archetype.test.skip>true</archetype.test.skip>
      </properties>
    </profile>

    <profile>
      <!-- NOTE debug, error and informal logs,
        if none selected, the default is informal -->
      <id>mode-logs-level-debug</id>
      <properties>
        <log.root.level>debug</log.root.level>
      </properties>
    </profile>

    <profile>
      <!-- NOTE only errors and informal are required to log -->
      <id>mode-logs-level-error</id>
      <properties>
        <log.root.level>error</log.root.level>
      </properties>
    </profile>

    <profile>
      <!-- NOTE most detailed log level; includes all others -->
      <id>mode-logs-level-trace</id>
      <properties>
        <log.root.level>trace</log.root.level>
      </properties>
    </profile>

    <profile>
      <!-- NOTE for having faster Maven builds -->
      <id>mode-build-fast</id>
      <properties>
        <findbugs.skip>true</findbugs.skip>
        <formatter.skip>true</formatter.skip>
        <impsort.skip>true</impsort.skip>
        <maven.test.skip>true</maven.test.skip>
        <spotbugs.skip>true</spotbugs.skip>
        <archetype.test.skip>true</archetype.test.skip>
        <maven.javadoc.skip>true</maven.javadoc.skip>
        <gpg.skip>true</gpg.skip>
      </properties>
    </profile>

    <profile>
      <!-- NOTE for having lighter Maven logs -->
      <id>mode-build-quiet</id>
      <properties>
        <aspectj.showWeaveInfo>false</aspectj.showWeaveInfo>
        <aspectj.verbose>false</aspectj.verbose>
        <spotbugs.skip>true</spotbugs.skip>
        <maven.compiler.xlint>none</maven.compiler.xlint>
      </properties>
    </profile>

    <profile>
      <!-- NOTE for clean code during debugging
        it is sometimes necessary to turn off AspectJ weaving -->
      <id>mode-aspectj-skip</id>
      <properties>
        <aspectj.skip>true</aspectj.skip>
      </properties>
    </profile>

    <profile>
      <!--This plugin's configuration is used to store Eclipse m2e settings only.
        It has no influence on the Maven build itself.-->
      <!-- https://stackoverflow.com/questions/7905501/get-rid-of-pom-not-found-warning-for-org-eclipse-m2elifecycle-mapping -->
      <id>mode-eclipse</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-plugin-plugin</artifactId>
                        <versionRange>[3.6.1,)</versionRange>
                        <goals>
                          <goal>descriptor</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-help-plugin</artifactId>
                        <versionRange>[3.2.0,)</versionRange>
                        <goals>
                          <goal>active-profiles</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <!-- The update site for Findbugs M2E connector
                      https://github.com/m2e-code-quality/m2e-code-quality
                      is invalid-->
                      <pluginExecutionFilter>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <versionRange>[1.0.0,)</versionRange>
                        <goals>
                          <goal>check</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>dev.aspectj</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <versionRange>[1.0,)</versionRange>
                        <goals>
                          <goal>compile</goal>
                          <goal>test-compile</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

  <reporting>
    <!-- NOTE: generate a site by running
      mvnw site site:stage scm-publish:publish-scm
      -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>3.0.0-M7</version>
      </plugin>
    </plugins>
  </reporting>

</project>
