<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>taskana-rest-spring-example-boot</artifactId>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Demo project for taskana-rest-spring</description>

  <parent>
    <groupId>pro.taskana</groupId>
    <artifactId>taskana-rest-parent</artifactId>
    <version>8.1.1-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <properties>
    <sonar.tests/>
  </properties>

  <dependencies>
    <dependency>
      <groupId>pro.taskana</groupId>
      <artifactId>taskana-common-logging</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>
    <dependency>
      <groupId>com.ibm.db2</groupId>
      <artifactId>jcc</artifactId>
      <version>${version.db2}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
    <!-- Postgresql driver dependency -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ojdbc8</artifactId>
      <version>${version.oracle}</version>
    </dependency>
    <dependency>
      <groupId>pro.taskana</groupId>
      <artifactId>taskana-rest-spring-example-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>${version.spring-openapi}</version>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>history.plugin</id>
      <dependencies>
        <dependency>
          <groupId>pro.taskana.history</groupId>
          <artifactId>taskana-simplehistory-rest-spring</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${version.maven.resources}</version>
            <executions>
              <execution>
                <id>copy-history-rest-documentation-to-static-folder</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>
                    ${project.build.outputDirectory}/static/docs/rest
                  </outputDirectory>
                  <resources>
                    <resource>
                      <directory>
                        ../../history/taskana-simplehistory-rest-spring/target/generated-docs
                      </directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>historyLogging.plugin</id>
      <dependencies>
        <dependency>
          <groupId>pro.taskana.history</groupId>
          <artifactId>taskana-loghistory-provider</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-security</artifactId>
          <exclusions>
            <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-jdbc</artifactId>
          <exclusions>
            <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
          <exclusions>
            <exclusion>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>dmn-routing.plugin</id>
      <dependencies>
        <dependency>
          <groupId>pro.taskana</groupId>
          <artifactId>taskana-spi-routing-dmn-router</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>pro.taskana</groupId>
          <artifactId>taskana-routing-rest</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${version.maven.resources}</version>
            <executions>
              <execution>
                <id>copy-routing-rest-documentation-to-static-folder</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>
                    ${project.build.outputDirectory}/static/docs/rest
                  </outputDirectory>
                  <resources>
                    <resource>
                      <directory>
                        ../../routing/taskana-routing-rest/target/generated-docs
                      </directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${version.spring.boot}</version>
        <configuration>
          <!-- disable process forking that is enabled by default
              in spring-boot 2.2.0.RELEASE and higher -->
          <fork>false</fork>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${version.maven.resources}</version>
        <executions>
          <execution>
            <id>copy-rest-documentation-to-static-folder</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.outputDirectory}/static/docs/rest
              </outputDirectory>
              <resources>
                <resource>
                  <directory>
                    ../taskana-rest-spring/target/generated-docs
                  </directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-taskana-core-docs</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.outputDirectory}/static/docs/java/taskana-core
              </outputDirectory>
              <resources>
                <resource>
                  <directory>
                    ../../lib/taskana-core/target/apidocs
                  </directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-taskana-cdi-docs</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.outputDirectory}/static/docs/java/taskana-cdi
              </outputDirectory>
              <resources>
                <resource>
                  <directory>
                    ../../lib/taskana-cdi/target/apidocs
                  </directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-taskana-spring-docs</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>
                ${project.build.outputDirectory}/static/docs/java/taskana-spring
              </outputDirectory>
              <resources>
                <resource>
                  <directory>
                    ../../lib/taskana-spring/target/apidocs
                  </directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
