<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.optaplanner</groupId>
    <artifactId>optaplanner-build-parent</artifactId>
    <version>8.4.0.Final</version>
    <relativePath/>
  </parent>

  <groupId>org.optaweb.employeerostering</groupId>
  <artifactId>optaweb-employee-rostering</artifactId>
  <packaging>pom</packaging>

  <name>OptaWeb Employee Rostering as a Service Parent</name>
  <description>
    OptaWeb Employee Rostering as a Service with OptaPlanner on OpenShift 4.
  </description>
  <url>https://www.optaplanner.org</url>
  <inceptionYear>2017</inceptionYear>

  <repositories>
    <!-- Bootstrap repository to locate the parent pom when the parent pom has not been build locally. -->
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <properties>
    <!-- Define JaCoCo agent argLine property to avoid Surefire failure when JaCoCo is not enabled. -->
    <jacoco.agent.argLine/>

    <sonar.projectKey>optaweb-employee-rostering</sonar.projectKey>
    <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>

    <version.com.sun.xml.bind>2.3.0</version.com.sun.xml.bind>
    <version.frontend-maven-plugin>1.8.0</version.frontend-maven-plugin>
    <version.io.springfox>2.9.2</version.io.springfox>
    <version.javax.activation>1.1.1</version.javax.activation>
    <version.javax.validation>2.0.1.Final</version.javax.validation>
    <version.node>v12.16.2</version.node>
    <version.npm>6.14.4</version.npm>
    <version.org.apache.poi>4.1.2</version.org.apache.poi>
    <version.org.jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec>1.0.1.Final</version.org.jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec>
    <version.org.mockito>2.12.0</version.org.mockito>
    <version.org.springframework.boot>2.2.6.RELEASE</version.org.springframework.boot>
  </properties>

  <modules>
    <module>optaweb-employee-rostering-frontend</module>
    <module>optaweb-employee-rostering-backend</module>
    <module>optaweb-employee-rostering-benchmark</module>
    <module>optaweb-employee-rostering-docs</module>
    <module>optaweb-employee-rostering-distribution</module>
    <module>optaweb-employee-rostering-standalone</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <!-- Internal modules -->
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-frontend</artifactId>
        <type>zip</type>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-frontend</artifactId>
        <type>pom</type>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-backend</artifactId>
        <type>jar</type>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-backend</artifactId>
        <classifier>exec</classifier>
        <type>jar</type>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-docs</artifactId>
        <type>zip</type>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.optaweb.employeerostering</groupId>
        <artifactId>optaweb-employee-rostering-standalone</artifactId>
        <classifier>exec</classifier>
        <version>${project.version}</version>
      </dependency>

      <!-- BOMs -->
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${version.org.springframework.boot}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <!-- Other dependencies -->
      <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>${version.javax.validation}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-core</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-spring-web</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-common</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-spi</artifactId>
        <version>${version.io.springfox}</version>
      </dependency>

      <dependency>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-annotations</artifactId>
        <version>1.5.20</version>
      </dependency>

      <!-- Excel -->
      <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>${version.org.apache.poi}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${version.org.apache.poi}</version>
      </dependency>

      <!-- Required for Java 11 -->
      <dependency>
        <groupId>org.jboss.spec.javax.xml.bind</groupId>
        <artifactId>jboss-jaxb-api_2.3_spec</artifactId>
        <version>${version.org.jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec}</version>
      </dependency>
      <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${version.com.sun.xml.bind}</version>
      </dependency>
      <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>${version.com.sun.xml.bind}</version>
      </dependency>
      <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>${version.javax.activation}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>analyze-only</id>
              <phase>none</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${version.org.springframework.boot}</version>
        </plugin>
        <plugin>
          <groupId>com.github.eirslett</groupId>
          <artifactId>frontend-maven-plugin</artifactId>
          <version>${version.frontend-maven-plugin}</version>
          <configuration>
            <nodeVersion>${version.node}</nodeVersion>
            <npmVersion>${version.npm}</npmVersion>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <!-- Skip Sonar plugin execution if SONARCLOUD_TOKEN is not set. -->
      <id>skipSonar</id>
      <activation>
        <property>
          <name>!env.SONARCLOUD_TOKEN</name>
        </property>
      </activation>
      <properties>
        <sonar.skip>true</sonar.skip>
      </properties>
    </profile>
    <profile>
      <!--
        TODO: For moving the coverage measurement from Travis to Jenkins, add the repository name to
        SONARCLOUD_ENABLED_REPOSITORIES in
        https://github.com/kiegroup/kie-jenkins-scripts/blob/master/job-dsls/jobs/pr_jobs.groovy
      -->
      <id>run-code-coverage</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <!-- Append jacoco.agent.argLine property populated by JaCoCo's prepare-agent goal. -->
                <argLine>@{jacoco.agent.argLine}</argLine>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>jacoco-prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <!-- Append coverage data to a single file defined in the kie-parent -->
                  <append>true</append>
                  <destFile>${jacoco.exec.file}</destFile>
                  <propertyName>jacoco.agent.argLine</propertyName>
                  <excludes>
                    <exclude>*Lexer</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
