<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2026 Aletyx, Inc. and/or its affiliates.

  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>ai.aletyx.kogito</groupId>
  <artifactId>aletyx-kogito-addons-springboot-dev-console</artifactId>
  <version>10.2.0</version>
  <packaging>jar</packaging>

  <name>Aletyx Kogito Add-ons :: Spring Boot Dev Console</name>
  <description>A jBPM Dev Console for Spring Boot, by Aletyx. A temporary stop-gap that brings the Apache KIE process Dev UI (Process Instances, Jobs, Tasks, Forms) to Spring Boot applications until it is available in an upstream Apache KIE release.</description>
  <url>https://github.com/aletyx/aletyx-kogito-addons-springboot-dev-console</url>
  <inceptionYear>2026</inceptionYear>

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

  <organization>
    <name>Aletyx, Inc.</name>
    <url>https://aletyx.ai/</url>
  </organization>

  <developers>
    <developer>
      <id>aletyx</id>
      <name>Aletyx Engineering</name>
      <email>opensource@aletyx.ai</email>
      <organization>Aletyx, Inc.</organization>
      <organizationUrl>https://aletyx.ai/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/aletyx/aletyx-kogito-addons-springboot-dev-console.git</connection>
    <developerConnection>scm:git:git@github.com:aletyx/aletyx-kogito-addons-springboot-dev-console.git</developerConnection>
    <url>https://github.com/aletyx/aletyx-kogito-addons-springboot-dev-console</url>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/aletyx/aletyx-kogito-addons-springboot-dev-console/issues</url>
  </issueManagement>

  <properties>
    <compiler-plugin.version>3.13.0</compiler-plugin.version>
    <maven.compiler.release>17</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputTimestamp>2026-06-16T00:00:00Z</project.build.outputTimestamp>

    <!-- Aligned with the Apache KIE 10.2.0 release this stop-gap targets. -->
    <kogito.bom.version>10.2.0</kogito.bom.version>
    <spring-boot.version>3.5.10</spring-boot.version>

    <!-- Web application bundled into the dev console at build time. -->
    <runtime-tools-webapp.npm-version>10.2.0</runtime-tools-webapp.npm-version>
    <!-- Directory where the npm web application tarball is unpacked. -->
    <webapp.unpack.dir>${project.build.directory}/runtime-tools-webapp</webapp.unpack.dir>

    <!-- Testing -->
    <junit.version>5.10.2</junit.version>

    <!-- Build plugins -->
    <download-plugin.version>1.13.0</download-plugin.version>
    <resources-plugin.version>3.3.1</resources-plugin.version>
    <surefire-plugin.version>3.2.5</surefire-plugin.version>

    <!-- Release plugins (active only in the `release` profile). -->
    <source-plugin.version>3.3.1</source-plugin.version>
    <javadoc-plugin.version>3.11.2</javadoc-plugin.version>
    <gpg-plugin.version>3.2.7</gpg-plugin.version>
    <central-publishing-plugin.version>0.7.0</central-publishing-plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- Imported to pin the exact Spring Boot version this stop-gap is aligned with. -->
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-autoconfigure</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- 1. Download the prebuilt process Dev UI web application from npm. The
              published tarball already contains the compiled standalone bundle;
              we only fetch and unpack it, no Node toolchain required. -->
      <plugin>
        <groupId>com.googlecode.maven-download-plugin</groupId>
        <artifactId>download-maven-plugin</artifactId>
        <version>${download-plugin.version}</version>
        <executions>
          <execution>
            <id>download-runtime-tools-webapp</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>https://registry.npmjs.org/@kie-tools/runtime-tools-process-dev-ui-webapp/-/runtime-tools-process-dev-ui-webapp-${runtime-tools-webapp.npm-version}.tgz</url>
              <unpack>true</unpack>
              <outputDirectory>${webapp.unpack.dir}</outputDirectory>
              <skipCache>true</skipCache>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- 2. Copy the unpacked web application into the classpath under
              dev-static/, where the controller and resource handler serve it. -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${resources-plugin.version}</version>
        <executions>
          <execution>
            <id>copy-webapp</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/dev-static/webapp</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${webapp.unpack.dir}/package/dist/resources/webapp</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-form-displayer</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/dev-static</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${webapp.unpack.dir}/package/dist/resources</directory>
                  <includes>
                    <include>form-displayer.html</include>
                    <include>form-displayer.js</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <parameters>true</parameters>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!--
      Release profile — activate with `-Prelease` on `mvn deploy`.
      Adds source + javadoc jars, PGP-signs every artifact, and uploads to the
      Maven Central Portal (https://central.sonatype.com). Idle by default so
      day-to-day `./mvnw install` doesn't need GPG keys, javadoc, or Sonatype
      credentials.
    -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>${source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${javadoc-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <doclint>none</doclint>
                  <quiet>true</quiet>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>${env.GPG_KEY_ID}</keyname>
                  <passphraseEnvName>GPG_PASSPHRASE</passphraseEnvName>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${central-publishing-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>false</autoPublish>
              <waitUntil>uploaded</waitUntil>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
