<?xml version="1.0" encoding="UTF-8"?>
<!--

    JBoss, Home of Professional Open Source.
    Copyright 2021-2024 Red Hat, Inc., and individual contributors
    as indicated by the @author tags.

    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>
  <groupId>org.jboss.pnc.rex</groupId>
  <artifactId>parent</artifactId>
  <version>1.2.2</version>
  <packaging>pom</packaging>

  <name>Rex</name>
  <description>Clusterable scheduler of remotely executed tasks</description>
  <url>https://github.com/project-ncl/rex</url>
  <inceptionYear>2021</inceptionYear>

  <scm>
    <connection>scm:git:https://github.com/project-ncl/rex.git</connection>
    <developerConnection>scm:git:git@github.com:project-ncl/rex.git</developerConnection>
    <url>https://github.com/project-ncl/rex/</url>
    <tag>1.2.2</tag>
  </scm>
  
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <distribution>repo</distribution>
      <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <organization>RedHat</organization>
      <organizationUrl>http://www.redhat.com</organizationUrl>
    </developer>
  </developers>

  <modules>
    <module>core</module>
    <module>dto</module>
    <module>common</module>
    <module>model</module>
    <module>api</module>
    <module>rest-client</module>
  </modules>

  <properties>
    <quarkus.version>3.21.4</quarkus.version>
    <quarkus-openapi-generator.version>2.10.0-lts</quarkus-openapi-generator.version>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <compiler-plugin.version>3.12.1</compiler-plugin.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
    <surefire-plugin.version>3.2.3</surefire-plugin.version>
    <lombok.version>1.18.32</lombok.version>
    <delombok-plugin.version>1.18.20.0</delombok-plugin.version>
    <slf4j.version>1.7.28</slf4j.version>
    <assertj.version>3.27.3</assertj.version>
    <restassured.version>4.1.1</restassured.version>
    <mapstruct.version>1.5.5.Final</mapstruct.version>
    <pnc-api.version>3.0.5</pnc-api.version>
    <nexus-staging-plugin.version>1.7.0</nexus-staging-plugin.version>
    <maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
    <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
  </properties>
  
  <dependencyManagement>
    <dependencies>
      <!-- Modules -->
      <dependency>
        <groupId>org.jboss.pnc.rex</groupId>
        <artifactId>rex-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.pnc.rex</groupId>
        <artifactId>rex-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.pnc.rex</groupId>
        <artifactId>rex-dto</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.pnc.rex</groupId>
        <artifactId>rex-model</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.pnc.rex</groupId>
        <artifactId>rex-api</artifactId>
        <version>${project.version}</version>
      </dependency>

      <!-- Quarkus dependencies -->
      <dependency>
        <groupId>io.quarkus.platform</groupId>
        <artifactId>quarkus-bom</artifactId>
        <version>${quarkus.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>io.quarkiverse.openapi.generator</groupId>
        <artifactId>quarkus-openapi-generator</artifactId>
        <version>${quarkus-openapi-generator.version}</version>
      </dependency>

      <dependency>
        <groupId>io.quarkiverse.openapi.generator</groupId>
        <artifactId>quarkus-openapi-generator-oidc</artifactId>
        <version>${quarkus-openapi-generator.version}</version>
      </dependency>

      <!-- Regular dependencies -->
      <dependency>
        <groupId>org.jboss.pnc</groupId>
        <artifactId>pnc-api</artifactId>
        <version>${pnc-api.version}</version>
        <classifier>jakarta</classifier>
        <exclusions>
          <exclusion>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.json.bind</groupId>
            <artifactId>javax.json.bind-api</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${mapstruct.version}</version>
      </dependency>
      <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-processor</artifactId>
        <version>${mapstruct.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>2.11</version>
          <configuration>
            <properties>
              <copyright-years>${project.inceptionYear}-2024</copyright-years>
            </properties>
            <header>./.license-header.txt</header>
            <excludes>
              <exclude>**/README.md</exclude>
              <exclude>**/LICENSE</exclude>
              <exclude>**/eclipse-codeStyle.xml</exclude>
              <exclude>.license-header.txt</exclude>
              <exclude>**/Dockerfile</exclude>
              <exclude>**/scripts/**</exclude>
              <exclude>**/images/**</exclude>
              <exclude>**/.dockerignore</exclude>
              <exclude>**/.mvn/**</exclude>
              <exclude>**/mvnw*</exclude>
              <exclude>**/**.properties</exclude>
              <exclude>**/infinispan-devservice-config.xml</exclude>
              <exclude>**/application*.yaml</exclude>
              <exclude>**/openapi.*</exclude>

              <!-- Exclude downloaded/generated -->
              <exclude>**/.cache/**</exclude>
              <exclude>**/rest-config.json</exclude>
              <exclude>**/Test*.html</exclude>

              <!-- Exclude everything under ignore subforder -->
              <exclude>**/ignore/**</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
            <groupId>org.eclipse.transformer</groupId>
            <artifactId>transformer-maven-plugin</artifactId>
            <version>0.5.0</version>
            <extensions>true</extensions>
            <configuration>
                <rules>
                    <jakartaDefaults>true</jakartaDefaults>
                    <invert>true</invert>
                </rules>
                <classifier>javax</classifier>
            </configuration>
        </plugin>
        <plugin>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok-maven-plugin</artifactId>
          <version>${delombok-plugin.version}</version>
          <configuration>
            <sourceDirectory>src/main/java</sourceDirectory>
            <outputDirectory>${delombok.output}</outputDirectory>
            <addOutputDirectory>false</addOutputDirectory>
          </configuration>
          <executions>
            <execution>
              <phase>prepare-package</phase>
              <goals>
                <goal>delombok</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.8.0</version>
          <configuration>
            <sourcepath>target/generated-sources/delombok;target/generated-sources/open-api</sourcepath>
            <doclint>all,-missing</doclint>
          </configuration>
          <executions>
            <execution>
              <phase>package</phase>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-maven-plugin</artifactId>
          <version>${quarkus.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>generate-code</goal>
                <goal>generate-code-tests</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <compilerArgs>
            <arg>
              -parameters
            </arg>
          </compilerArgs>
          <forceJavacCompilerUse>true</forceJavacCompilerUse>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <reportFormat>plain</reportFormat>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
            <maven.home>${maven.home}</maven.home>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>check</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <tagNameFormat>@{project.version}</tagNameFormat>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>${central-publishing-maven-plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
            <!-- as defined in your settings.xml -->
            <publishingServerId>central-publisher</publishingServerId>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>native</id>
      <properties>
        <quarkus.package.type>native</quarkus.package.type>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${surefire-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                    <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    <maven.home>${maven.home}</maven.home>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>license-format</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>format</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>format</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven-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-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
