<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kie.kogito.examples</groupId>
    <artifactId>kogito-examples</artifactId>
    <version>1.14.1.Final</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>
  <artifactId>onboarding-springboot</artifactId>
  <name>Kogito Example :: Onboarding Example :: Onboarding with Business Process Spring Boot</name>
  <description>Onboarding function and service orchestration</description>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-spring-boot-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-processes-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-springboot-monitoring-prometheus</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-addons-springboot-kubernetes</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-spring-boot-test-utils</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-maven-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>persistence</id>
      <activation>
        <property>
          <name>persistence</name>
        </property>
      </activation>
      <properties>
        <enable.resource.infinispan>true</enable.resource.infinispan>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.kie.kogito</groupId>
          <artifactId>kogito-addons-persistence-infinispan</artifactId>
        </dependency>
        <dependency>
          <groupId>org.infinispan</groupId>
          <artifactId>infinispan-spring-boot-starter-remote</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>kubernetes</id>
      <activation>
        <property>
          <name>kubernetes</name>
        </property>
      </activation>
      <properties>
        <jkube.mode>kubernetes</jkube.mode>
        <jkube.generator.java-exec.webPort>8080</jkube.generator.java-exec.webPort>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.jkube</groupId>
            <artifactId>kubernetes-maven-plugin</artifactId>
            <configuration>
              <resources>
                <imagePullPolicy>IfNotPresent</imagePullPolicy>
                <labels>
                  <all>
                    <onboarding>process</onboarding>
                  </all>
                </labels>
                <serviceAccounts>
                  <serviceAccount>
                    <name>${project.artifactId}</name>
                    <deploymentRef>${project.artifactId}</deploymentRef>
                  </serviceAccount>
                </serviceAccounts>
              </resources>
              <generator>
                <includes>
                  <include>spring-boot</include>
                </includes>
                <config>
                  <spring-boot>
                    <color>always</color>
                  </spring-boot>
                </config>
              </generator>
              <enricher>
                <config>
                  <jkube-service>
                    <type>NodePort</type>
                  </jkube-service>
                </config>
              </enricher>
              <images>
                <image>
                  <name>kogito/%a</name>
                  <build>
                    <from>registry.access.redhat.com/ubi8/openjdk-11:latest</from>
                    <assembly>
                      <targetDir>/deployments</targetDir>
                    </assembly>
                    <ports>
                      <port>8080/tcp</port>
                    </ports>
                  </build>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>resource</goal>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
