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

  <parent>
    <groupId>org.jboss</groupId>
    <artifactId>jboss-parent</artifactId>
    <version>43</version>
  </parent>

  <groupId>io.hawt</groupId>
  <artifactId>project</artifactId>
  <packaging>pom</packaging>
  <version>4.3.0</version>
  <name>hawtio-java-project</name>
  <description>Hawtio :: project</description>
  <url>https://hawt.io/</url>

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

  <scm>
    <connection>scm:git:git@github.com:hawtio/hawtio.git</connection>
    <developerConnection>scm:git:git@github.com:hawtio/hawtio.git</developerConnection>
    <url>git@github.com:hawtio/hawtio.git</url>
    <tag>hawtio-4.3.0</tag>
  </scm>

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

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

    <!-- Versions for major components -->
    <!-- Jolokia -->
    <jolokia-version>2.2.2</jolokia-version>
    <!-- Quarkus -->
    <quarkus-version>3.18.2</quarkus-version>
    <!-- Spring -->
    <!-- https://docs.spring.io/spring-boot/appendix/dependency-versions/coordinates.html -->
    <spring-version>6.2.2</spring-version>
    <spring-boot-version>3.4.2</spring-boot-version>
    <!-- Camel -->
    <camel-spring-boot-version>4.9.0</camel-spring-boot-version>
    <!-- Jetty -->
    <jetty-version>11.0.24</jetty-version>

    <!-- Other dependencies -->
    <assertj-core-version>3.27.0</assertj-core-version>
    <caffeine-version>3.2.0</caffeine-version>
    <commons-codec-version>1.18.0</commons-codec-version>
    <commons-io-version>2.18.0</commons-io-version>
    <commons-logging-version>1.3.4</commons-logging-version>
    <hamcrest-version>3.0</hamcrest-version>
    <httpcore-version>4.4.16</httpcore-version>
    <httpclient-version>4.5.14</httpclient-version>
    <jackson-version>2.18.2</jackson-version>
    <junit5-version>5.10.3</junit5-version>
    <log4j2-version>2.24.3</log4j2-version>
    <mockito-core-version>5.15.2</mockito-core-version>
    <nimbusds-jose-version>10.0.1</nimbusds-jose-version>
    <picocli-version>4.7.6</picocli-version>
    <servlet-api-version>5.0.0</servlet-api-version>
    <!-- Pin SLF4J version until https://issues.apache.org/jira/browse/CAMEL-20598 is resolved at SLF4J -->
    <slf4j-version>2.0.11</slf4j-version>

    <!-- Used for maven-frontend-plugin -->
    <node-version>v20.9.0</node-version>
    <yarn-version>v1.22.21</yarn-version>

    <!-- Maven plugins -->
    <build-helper-maven-plugin-version>3.6.0</build-helper-maven-plugin-version>
    <docker-plugin-version>0.45.1</docker-plugin-version>
    <exec-maven-plugin-version>3.5.0</exec-maven-plugin-version>
    <frontend-maven-plugin-version>1.15.1</frontend-maven-plugin-version>
    <jetty-plugin-version>11.0.24</jetty-plugin-version>
    <maven-antrun-plugin-version>3.1.0</maven-antrun-plugin-version>
    <maven-clean-plugin-version>3.4.0</maven-clean-plugin-version>
    <maven-compiler-plugin-version>3.13.0</maven-compiler-plugin-version>
    <maven-dependency-plugin-version>3.8.1</maven-dependency-plugin-version>
    <maven-failsafe-plugin-version>3.5.2</maven-failsafe-plugin-version>
    <maven-release-plugin-version>3.1.1</maven-release-plugin-version>
    <maven-resources-plugin-version>2.6</maven-resources-plugin-version>
    <maven-surefire-plugin-version>3.5.2</maven-surefire-plugin-version>
    <maven-war-plugin-version>3.4.0</maven-war-plugin-version>

    <!-- Overrides jboss-parent properties as otherwise releasing starts to fail since jboss-parent 43. -->
    <jboss.releases.repo.id>oss-sonatype-staging</jboss.releases.repo.id>
    <jboss.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</jboss.releases.repo.url>
    <jboss.snapshots.repo.id>oss-sonatype-snapshots</jboss.snapshots.repo.id>
    <jboss.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</jboss.snapshots.repo.url>
  </properties>

  <modules>
    <module>bom</module>
    <module>console</module>
    <module>console-minimal</module>
    <module>deploy/hawtio-default</module>
    <module>deploy/hawtio-embedded</module>
    <module>examples/quarkus</module>
    <module>examples/quarkus-keycloak</module>
    <module>examples/sample-plugin</module>
    <module>examples/war-plugin</module>
    <module>hawtio-jbang</module>
    <module>hawtio-plugin-mbean</module>
    <module>hawtio-system</module>
    <module>hawtio-war</module>
    <module>hawtio-war-minimal</module>
    <module>platforms/quarkus</module>
    <module>plugins/hawtio-connect</module>
    <module>plugins/hawtio-local-jvm-mbean</module>
    <module>plugins/hawtio-log-logback</module>
    <module>plugins/hawtio-log</module>
  </modules>

  <build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>11</source>
          <testSource>11</testSource>
          <target>11</target>
          <testTarget>11</testTarget>
          <release>11</release>
          <testRelease>11</testRelease>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-integration-test-sources</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/integration-test/java</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-integration-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <filtering>true</filtering>
                  <directory>src/integration-test/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
          <childDelegation>false</childDelegation>
          <useFile>true</useFile>
          <failIfNoTests>false</failIfNoTests>
          <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
          <runOrder>alphabetical</runOrder>
          <systemPropertyVariables>
            <basedir>${basedir}</basedir>
            <java.awt.headless>true</java.awt.headless>
          </systemPropertyVariables>

          <excludes>
            <exclude>**/*IT.*</exclude>
            <exclude>**/*ITCase.*</exclude>
          </excludes>

          <includes>
            <include>**/*Test.*</include>
          </includes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <executions>
          <execution>
            <id>integration-tests</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <excludes>
            <exclude>**/*Test.*</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-failsafe-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin-version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>${maven-war-plugin-version}</version>
        </plugin>
        <plugin>
          <groupId>com.github.eirslett</groupId>
          <artifactId>frontend-maven-plugin</artifactId>
          <version>${frontend-maven-plugin-version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build-helper-maven-plugin-version}</version>
        </plugin>
        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <version>${docker-plugin-version}</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>${jetty-plugin-version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

  </build>

  <profiles>
    <profile>
      <id>jdk17</id>
      <activation>
        <jdk>[17,)</jdk>
      </activation>
      <modules>
        <module>examples/springboot</module>
        <module>examples/springboot-authentication</module>
        <module>examples/springboot-keycloak</module>
        <module>examples/springboot-log4j2</module>
        <module>examples/springboot-plugin</module>
        <module>examples/springboot-security</module>
        <module>platforms/springboot</module>
        <module>platforms/springboot-security</module>
      </modules>
    </profile>

    <profile>
      <id>fastinstall</id>
      <properties>
        <skipTests>true</skipTests>
        <skip.yarn>true</skip.yarn>
      </properties>
    </profile>

    <profile>
      <id>e2e</id>
      <modules>
        <module>tests</module>
      </modules>
    </profile>

    <profile>
      <id>release</id>
      <!--
      TODO when using the release profile you should add your ~/.m2/settings.xml something like this:

      <settings>
        <profiles>
          <profile>
            <id>release</id>
            <properties>
              <gpg.passphrase>MyPassPhrase</gpg.passphrase>
            </properties>
          </profile>
          ...
      -->

      <!--
        Run the release /w the -P release flag to enable the release profile.
      -->
      <build>
        <plugins>
          <!-- We want to sign the artifact, the POM, and all attached artifacts -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <configuration>
              <!--suppress UnresolvedMavenProperty -->
              <passphrase>${gpg.passphrase}</passphrase>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>sign</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-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <encoding>${project.build.sourceEncoding}</encoding>
              <doclint>none</doclint>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- Only when testing a staged release of new Jolokia version
  <repositories>
    <repository>
      <id>orgjolokia-1074</id>
      <url>https://oss.sonatype.org/content/repositories/orgjolokia-1074/</url>
    </repository>
  </repositories>
  -->

</project>
