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

  <parent>
    <groupId>dev.orne</groupId>
    <artifactId>root-pom</artifactId>
    <version>1.1.1</version>
  </parent>

  <artifactId>java-root-pom</artifactId>
  <packaging>pom</packaging>

  <name>Orne Java Root POM</name>
  <description>Orne Java Root POM</description>
  <url>${github.page.url}java/</url>

  <modules>
    <module>java-module-root-pom</module>
  </modules>

  <properties>
    <maven.required.version>3.8.1</maven.required.version>
    
    <java.version>11</java.version>
    <java.target.version>${java.version}</java.target.version>
    <java.jdk.version>${java.version}</java.jdk.version>

    <slf4j.version>2.0.17</slf4j.version>
    <logback.version>1.5.18</logback.version>
    <apiguardian.version>1.1.2</apiguardian.version>

    <junit.jupiter.version>5.13.4</junit.jupiter.version>
    <junit.pioneer.version>2.3.0</junit.pioneer.version>
    <mockito.version>5.20.0</mockito.version>

    <plugins.toolchains.version>3.2.0</plugins.toolchains.version>
    <plugins.compiler.version>3.14.0</plugins.compiler.version>
    <plugins.surefire.version>3.5.4</plugins.surefire.version>
    <plugins.failsafe.version>3.5.4</plugins.failsafe.version>
    <plugins.surefire-report.version>3.5.4</plugins.surefire-report.version>
    <plugins.jacoco.version>0.8.13</plugins.jacoco.version>
    <plugins.jar.version>3.4.2</plugins.jar.version>
    <plugins.eclipse.transform.version>1.0.0</plugins.eclipse.transform.version>
    <plugins.source.version>3.3.1</plugins.source.version>
    <plugins.javadoc.version>3.12.0</plugins.javadoc.version>
    <plugins.revapi.version>0.15.1</plugins.revapi.version>
    <plugins.revapi.java.version>0.28.4</plugins.revapi.java.version>
    <plugins.jxr.version>3.6.0</plugins.jxr.version>

    <ut.skip>false</ut.skip>
    <ut.reportDir>${project.build.directory}/ut-reports</ut.reportDir>
    <ut.coverage.reportDir>${project.build.directory}/ut-coverage-reports</ut.coverage.reportDir>
    <ut.coverage.xmlReport>${ut.coverage.reportDir}/jacoco.xml</ut.coverage.xmlReport>
    <it.skip>false</it.skip>
    <it.reportDir>${project.build.directory}/it-reports</it.reportDir>
    <it.coverage.reportDir>${project.build.directory}/it-coverage-reports</it.coverage.reportDir>
    <it.coverage.xmlReport>${it.coverage.reportDir}/jacoco.xml</it.coverage.xmlReport>

    <jakarta.transform.skip>false</jakarta.transform.skip>
    <revapi.config.file>${project.basedir}/revapi.config.json</revapi.config.file>
    <release.verify.goals>clean verify -Put,it,pre-release</release.verify.goals>
    <release.perform.goals>clean deploy -Prelease</release.perform.goals>
    <hotfix.verify.goals>clean verify -Put,it,pre-release</hotfix.verify.goals>
    <hotfix.perform.goals>clean deploy -Prelease</hotfix.perform.goals>

    <sonar.java.source>${java.version}</sonar.java.source>
    <sonar.junit.reportPaths>${ut.reportDir},${it.reportDir}</sonar.junit.reportPaths>
    <sonar.coverage.jacoco.xmlReportPaths>${ut.coverage.xmlReport},${it.coverage.xmlReport}</sonar.coverage.jacoco.xmlReportPaths>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jul-to-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apiguardian</groupId>
        <artifactId>apiguardian-api</artifactId>
        <version>${apiguardian.version}</version>
      </dependency>

      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit-pioneer</groupId>
        <artifactId>junit-pioneer</artifactId>
        <version>${junit.pioneer.version}</version>
        <scope>test</scope>
        <exclusions>
          <exclusion>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${plugins.license.version}</version>
          <executions>
            <execution>
              <id>update-license-file</id>
              <goals>
                <goal>update-project-license</goal>
              </goals>
            </execution>
            <execution>
              <id>update-third-party-file</id>
              <goals>
                <goal>add-third-party</goal>
              </goals>
              <configuration>
                <excludedScopes>test,provided</excludedScopes>
              </configuration>
            </execution>
            <execution>
              <id>update-source-license-headers</id>
              <phase>process-sources</phase>
              <goals>
                <goal>update-file-header</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-toolchains-plugin</artifactId>
          <version>${plugins.toolchains.version}</version>
          <configuration>
            <toolchains>
              <jdk>
                <version>${java.jdk.version}</version>
              </jdk>
            </toolchains>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${plugins.compiler.version}</version>
          <configuration>
            <release>${java.target.version}</release>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${plugins.surefire.version}</version>
          <configuration>
            <skip>true</skip>
            <reportsDirectory>${ut.reportDir}</reportsDirectory>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${plugins.failsafe.version}</version>
          <configuration>
            <skip>true</skip>
            <reportsDirectory>${it.reportDir}</reportsDirectory>
            <summaryFile>${it.reportDir}/failsafe-summary.xml</summaryFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${plugins.jacoco.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${plugins.jar.version}</version>
          <configuration>
            <archive>
              <addMavenDescriptor>false</addMavenDescriptor>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
              <manifestEntries>
                <Specification-Title>${project.name}</Specification-Title>
                <Specification-Version>${project.version}</Specification-Version>
                <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                <Implementation-Title>${project.name}</Implementation-Title>
                <Implementation-Version>${project.version}</Implementation-Version>
                <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                <url>${project.url}</url>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.transformer</groupId>
          <artifactId>transformer-maven-plugin</artifactId>
          <version>${plugins.eclipse.transform.version}</version>
          <extensions>true</extensions>
          <configuration>
            <rules>
              <jakartaDefaults>true</jakartaDefaults>
            </rules>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${plugins.source.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>${plugins.javadoc.version}</version>
          <executions>
            <execution>
              <id>attach-javadoc</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <source>${java.source.version}</source>
            <failOnError>false</failOnError>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.revapi</groupId>
          <artifactId>revapi-maven-plugin</artifactId>
          <version>${plugins.revapi.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.revapi</groupId>
              <artifactId>revapi-java</artifactId>
              <version>${plugins.revapi.java.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <analysisConfigurationFiles>
              <file>${revapi.config.file}</file>
            </analysisConfigurationFiles>
          </configuration>
          <executions>
            <execution>
              <id>api-check</id>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jxr-plugin</artifactId>
          <version>${plugins.jxr.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-report-plugin</artifactId>
          <version>${plugins.surefire-report.version}</version>
          <configuration>
            <reportsDirectories>
              <reportsDirectory>${ut.reportDir}</reportsDirectory>
              <reportsDirectory>${it.reportDir}</reportsDirectory>
            </reportsDirectories>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>jxr</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>jpms-auto-module</id>
      <activation>
        <file>
          <missing>src/main/java/module-info.java</missing>
        </file>
      </activation>
      <properties>
        <java.module.name>${project.groupId}.${project.artifactId}</java.module.name>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jar-plugin</artifactId>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Automatic-Module-Name>${java.module.name}</Automatic-Module-Name>
                  </manifestEntries>
                </archive>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>ut</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <skip>${ut.skip}</skip>
                <argLine>${ut.coverage.agent.arg}</argLine>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.jacoco</groupId>
              <artifactId>jacoco-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>prepare-ut-agent</id>
                  <phase>process-test-classes</phase>
                  <goals>
                    <goal>prepare-agent</goal>
                  </goals>
                  <configuration>
                    <skip>${ut.skip}</skip>
                    <propertyName>ut.coverage.agent.arg</propertyName>
                    <append>true</append>
                  </configuration>
                </execution>
                <execution>
                  <id>generate-ut-coverage-report</id>
                  <phase>verify</phase>
                  <goals>
                    <goal>report</goal>
                  </goals>
                  <configuration>
                    <skip>${ut.skip}</skip>
                    <outputDirectory>${ut.coverage.reportDir}</outputDirectory>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>unit-tests</id>
                <configuration>
                  <skipSurefireReport>${ut.skip}</skipSurefireReport>
                  <reportsDirectories>
                    <reportsDirectory>${ut.reportDir}</reportsDirectory>
                  </reportsDirectories>
                </configuration>
                <reports>
                  <report>report-only</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>unit-tests-coverage-report</id>
                <configuration>
                  <skip>${ut.skip}</skip>
                </configuration>
                <reports>
                  <report>report</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <profile>
      <id>it</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <executions>
                <execution>
                  <id>integration-test</id>
                  <phase>integration-test</phase>
                  <goals>
                    <goal>integration-test</goal>
                  </goals>
                </execution>
                <execution>
                  <id>verify</id>
                  <phase>verify</phase>
                  <goals>
                    <goal>verify</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <skip>${it.skip}</skip>
                <reportsDirectory>${it.reportDir}</reportsDirectory>
                <summaryFile>${it.reportDir}/failsafe-summary.xml</summaryFile>
                <argLine>${it.coverage.agent.arg}</argLine>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.jacoco</groupId>
              <artifactId>jacoco-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>prepare-it-agent</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>prepare-agent-integration</goal>
                  </goals>
                  <configuration>
                    <skip>${it.skip}</skip>
                    <propertyName>it.coverage.agent.arg</propertyName>
                    <append>true</append>
                  </configuration>
                </execution>
                <execution>
                  <id>generate-it-coverage-report</id>
                  <phase>verify</phase>
                  <goals>
                    <goal>report-integration</goal>
                  </goals>
                  <configuration>
                    <skip>${it.skip}</skip>
                    <outputDirectory>${it.coverage.reportDir}</outputDirectory>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>integration-tests-report</id>
                <configuration>
                  <skipFailsafeReport>${it.skip}</skipFailsafeReport>
                  <reportsDirectories>
                    <reportsDirectory>${it.reportDir}</reportsDirectory>
                  </reportsDirectories>
                </configuration>
                <reports>
                  <report>failsafe-report-only</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <reportSets>
                <reportSet>
                  <id>integration-tests-coverage-report</id>
                  <configuration>
                    <skip>${it.skip}</skip>
                  </configuration>
                  <reports>
                    <report>report-integration</report>
                  </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <profile>
      <id>tools</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-invoker-plugin</artifactId>
              <configuration>
                <profiles>it,tools</profiles>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-toolchains-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>toolchain</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <site>
      <id>github</id>
      <name>Github Project Pages</name>
      <url>${project.url}</url>
    </site>
  </distributionManagement>

</project>
