<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>

  <artifactId>fluxnova-qa-tomcat-runtime</artifactId>
  <packaging>pom</packaging>

  <name>Fluxnova Platform - QA Tomcat Test Runtime</name>

  <parent>
    <groupId>org.finos.fluxnova.bpm.qa</groupId>
    <artifactId>fluxnova-qa</artifactId>
    <version>2.0.3</version>
  </parent>

  <dependencies>
    <dependency>
      <!--
        Make sure it comes after assembly in the build.
        Leave scope test, otherwise libs from pom will be copied into Tomcat's lib folder
      -->
      <groupId>org.finos.fluxnova.bpm.tomcat</groupId>
      <artifactId>fluxnova-tomcat-assembly</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

    <!--
      database drivers
      we deploy all and only activate one through server.xml
    -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.python</groupId>
      <artifactId>jython</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.finos.fluxnova.bpm.qa</groupId>
      <artifactId>fluxnova-qa-ensure-clean-db</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>tomcat</id>
      <build>
        <resources>
          <resource>
            <directory>src/main</directory>
            <filtering>true</filtering>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-server</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <inherited>false</inherited>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.finos.fluxnova.bpm.tomcat</groupId>
                      <artifactId>fluxnova-tomcat-assembly</artifactId>
                      <version>${project.version}</version>
                      <type>tar.gz</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>target/</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
              <execution>
                <id>copy-libs</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <inherited>false</inherited>
                <configuration>
                  <includeScope>runtime</includeScope>
                  <outputDirectory>target/server/apache-tomcat-${version.tomcat}/lib</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- copy filtered configuration resources -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
              <delimiters>
                <delimiter>${*}</delimiter>
              </delimiters>
              <useDefaultDelimiters>false</useDefaultDelimiters>
            </configuration>
            <executions>
              <execution>
                <id>copy-resources</id>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>resources</goal>
                </goals>
                <configuration>
                  <overwrite>true</overwrite>
                  <outputDirectory>target/server/apache-tomcat-${version.tomcat}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>engine-integration-jakarta</id>
      <dependencies>
        <dependency>
          <groupId>org.jboss.weld.servlet</groupId>
          <artifactId>weld-servlet-shaded</artifactId>
          <version>5.1.2.Final</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
