<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kie.kogito</groupId>
    <artifactId>integration-tests</artifactId>
    <version>1.4.1.Final</version>
  </parent>
  <artifactId>integration-tests-springboot</artifactId>
  <name>Kogito :: Integration Tests :: SpringBoot</name>

  <properties>
    <!-- Override version to match the one used by spring-kafka -->
    <version.org.apache.kafka>2.5.0</version.org.apache.kafka>
  </properties>
  
  <dependencies>
    <dependency> <!-- make this IT module to depend on the plugin for Maven reactor build intention -->
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-maven-plugin</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.kie.kogito</groupId>
      <artifactId>kogito-springboot-starter</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Force resolving dependencies in local Maven repo, needed for it tests -->
    <dependency>
       <groupId>io.rest-assured</groupId>
       <artifactId>json-schema-validator</artifactId>
       <!-- Manually override to 3.3.0 because Spring boot uses rest-assured-common internally -->
       <version>${version.io.rest-assured.springboot}</version>
       <scope>test</scope>
    </dependency>


    <dependency>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-spring-boot-starter-remote</artifactId>
      <version>${version.org.infinispan.starter}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-spring5-remote</artifactId>
      <version>${version.org.infinispan}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.projectreactor.kafka</groupId>
      <artifactId>reactor-kafka</artifactId>
      <version>${version.io.projectreactor.kafka}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-core</artifactId>
      <version>${version.io.projectreactor}</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-handler</artifactId>
      <version>${version.io.netty}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-transport-native-epoll</artifactId>
      <version>${version.io.netty}</version>
      <classifier>linux-x86_64</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-invoker-plugin</artifactId>
          <configuration>
            <streamLogs>true</streamLogs>
            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
            <settingsFile>src/it/settings.xml</settingsFile>
            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
            <postBuildHookScript>verify</postBuildHookScript> <!-- no extension required -->
            <properties>
              <container.image.infinispan>${container.image.infinispan}</container.image.infinispan>
            </properties>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>persistence</id>
      <activation>
        <property>
          <name>persistence</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <profiles>
                <profile>persistence</profile>
              </profiles>
              <properties>
                <enable.resource.infinispan>true</enable.resource.infinispan>
              </properties>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
