<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright The Narayana Authors
   SPDX short identifier: Apache-2.0
 -->
<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>
  <parent>
    <groupId>org.jboss.narayana.rts</groupId>
    <artifactId>rest-tx</artifactId>
    <version>7.1.0.Final</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>lra-parent</artifactId>
  <packaging>pom</packaging>
  <name>LRA Parent</name>
  <description>LRA Parent</description>

  <modules>
    <module>service-base</module>
    <module>client</module>
    <module>coordinator</module>
    <module>coordinator-war</module>
    <module>proxy</module>
    <module>test</module>
    <module>jaxrs</module>
  </modules>

  <properties>
    <!-- integration tests are disabled by default, use profile to run 'arq' -->
    <lra.test.timeout.factor>1.0</lra.test.timeout.factor>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <server.jvm.args>${jvm.args.other} ${jvm.args.memory} ${jvm.args.debug} ${jvm.args.modular}</server.jvm.args>
    <skipITs>true</skipITs>

    <test.logs.to.file>false</test.logs.to.file>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.narayana</groupId>
        <artifactId>narayana-bom-test</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <!-- for testing -->
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>jboss-public-releases-repository-group</id>
      <name>JBoss Public Releases Maven Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
    </repository>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>repo.eclipse.org-snapshots</id>
      <name>Eclipse MicroProfile Repository - Snapshots</name>
      <url>https://repo.eclipse.org/content/repositories/microprofile-snapshots</url>
    </repository>
  </repositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <inherited>false</inherited>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <redirectTestOutputToFile>${test.logs.to.file}</redirectTestOutputToFile>
          <skipITs>${skipITs}</skipITs>
          <systemPropertyVariables>
            <java.util.logging.config.file>${project.build.testOutputDirectory}/logging.properties</java.util.logging.config.file>
            <maven.test.classes.dir>${project.build.testOutputDirectory}</maven.test.classes.dir>
          </systemPropertyVariables>
          <includes>
            <!-- Integration tests running at the container -->
            <include>*IT.java</include>
            <include>*Tests.java</include>
            <!-- LRA TCK tests are named with 'Tests.java' -->
            <include>*TestCase.java</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Running only integration tests with failsafe plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <!-- Unit tests running with no container involved -->
            <include>*Test.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>default-install</id>
                <phase>install</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
