<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.optaplanner</groupId>
    <artifactId>optaplanner-parent</artifactId>
    <version>8.7.0.Final</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>optaplanner-build-parent</artifactId>
  <packaging>pom</packaging>

  <name>OptaPlanner build parent</name>

  <properties>
    <!-- ************************************************************************ -->
    <!-- Dependencies -->
    <!-- ************************************************************************ -->

    <!-- SNAPSHOT and KIE dependency versions -->
    <version.org.kie.kogito>1.7.0.Final</version.org.kie.kogito>
    <!-- Keep in sync with version.org.kie7 in kogito-runtimes: https://github.com/kiegroup/kogito-runtimes/blob/master/kogito-build-parent/pom.xml#L185 -->
    <version.org.kie7>7.54.0.Final</version.org.kie7>

    <!-- Normal dependency versions -->
    <!-- TODO Do we want import the quarkus-bom instead of defining these ourselves? -->
    <version.ch.qos.logback>1.2.3</version.ch.qos.logback>
    <version.commons-io>2.8.0</version.commons-io>
    <version.com.fasterxml.jackson.core>2.12.1</version.com.fasterxml.jackson.core>
    <version.com.h2database>1.4.197</version.com.h2database>
    <version.com.thoughtworks.xstream>1.4.16</version.com.thoughtworks.xstream>
    <version.io.quarkus>1.13.3.Final</version.io.quarkus>
    <version.io.quarkus.gizmo>1.0.7.Final</version.io.quarkus.gizmo>
    <version.org.ow2.asm>9.1</version.org.ow2.asm>
    <version.jakarta.json.bind>1.0.2</version.jakarta.json.bind>
    <version.jakarta.xml.bind>2.3.3</version.jakarta.xml.bind>
    <version.org.apache.commons.lang3>3.9</version.org.apache.commons.lang3>
    <version.org.apache.commons.math3>3.4.1</version.org.apache.commons.math3>
    <version.org.apache.poi>4.1.2</version.org.apache.poi>
    <version.org.assertj>3.14.0</version.org.assertj>
    <version.org.freemarker>2.3.28</version.org.freemarker>
    <version.org.hibernate>5.4.29.Final</version.org.hibernate>
    <version.org.jboss.jandex>2.2.3.Final</version.org.jboss.jandex>
    <version.org.jdom>1.1.3</version.org.jdom>
    <version.org.jfree.jfreechart>1.5.0</version.org.jfree.jfreechart>
    <version.org.junit>5.7.1</version.org.junit>
    <version.org.mockito>3.8.0</version.org.mockito>
    <version.org.postgresql>42.2.19</version.org.postgresql>
    <version.org.slf4j>1.7.30</version.org.slf4j>
    <version.org.springframework>5.3.6</version.org.springframework>
    <version.org.springframework.boot>2.4.5</version.org.springframework.boot>

    <!-- ************************************************************************ -->
    <!-- Plugins -->
    <!-- ************************************************************************ -->

    <maven.min.version>3.6.2</maven.min.version>
    <!-- An upcoming minor 8.x release will change this to 11 because the 8.x series require Java 11 or higher. -->
    <maven.compiler.release>8</maven.compiler.release>
    <!-- jboss suffixed version from jboss-parent which cannot be downloaded due to SNAPSHOT only policy for plugins from JBoss -->
    <version.compiler.plugin>3.8.1</version.compiler.plugin>
    <!-- The first version that supports analysis of classes compiled by Java 11. -->
    <version.dependency.plugin>3.1.2</version.dependency.plugin>
    <version.surefire.plugin>2.22.2</version.surefire.plugin>
    <!-- Versions plugin should stay on version 2.5
      until https://github.com/mojohaus/versions-maven-plugin/issues/312 is fixed -->
    <version.versions.plugin>2.5</version.versions.plugin>
    <!-- This property needs to be defined in all modules that use the packaging 'jar'.
         It is used by different plugins to make sure the module/bundle names are consistent. -->
    <java.module.name/>
    <formatter.skip>false</formatter.skip>
    <formatter.goal>format</formatter.goal>
    <!-- TODO name impsort should indicate it's related to formatting -->
    <impsort.goal>sort</impsort.goal>
    <!-- Jacoco plugin configurations -->
    <version.jacoco.plugin>0.8.5</version.jacoco.plugin>
    <!-- JaCoCo coverage data file location -->
    <jacoco.exec.file>${project.root.dir}/target/jacoco.exec</jacoco.exec.file>
    <jacoco.agent.argLine/>
    <enforcer.failOnDuplicatedClasses>true</enforcer.failOnDuplicatedClasses>
    <!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the API. -->
    <revapi.oldOptaplannerVersion>8.5.0.Final</revapi.oldOptaplannerVersion>
    <!--suppress UnresolvedMavenProperty-->
    <project.root.dir>${maven.multiModuleProjectDirectory}</project.root.dir>

    <schema.filename.benchmark>benchmark-with-import.xsd</schema.filename.benchmark>
    <schema.filename.solver>solver.xsd</schema.filename.solver>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- SNAPSHOT and KIE dependencies -->
      <dependency>
        <groupId>org.optaplanner</groupId>
        <artifactId>optaplanner-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>io.quarkus.gizmo</groupId>
        <artifactId>gizmo</artifactId>
        <version>${version.io.quarkus.gizmo}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss</groupId>
        <artifactId>jandex</artifactId>
        <version>${version.org.jboss.jandex}</version>
      </dependency>
      <!-- TODO use kogito-bom instead once Kogito excludes are obsolete https://issues.redhat.com/browse/KOGITO-3735 -->
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-api</artifactId>
        <version>${version.org.kie.kogito}</version>
        <exclusions>
          <exclusion>
            <groupId>org.kie</groupId>
            <artifactId>kie-dmn-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.kie.kogito</groupId>
            <artifactId>kogito-timer</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.kie.kogito</groupId>
            <artifactId>kogito-pmml-api-dependencies</artifactId>
          </exclusion>
          <exclusion>
            <!-- TODO remove jackson exclusion after fix https://issues.redhat.com/browse/KOGITO-3794 -->
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>drools-core</artifactId>
        <version>${version.org.kie.kogito}</version>
        <exclusions>
          <exclusion>
            <groupId>org.kie.kogito</groupId>
            <artifactId>kogito-timer</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>drools-compiler</artifactId>
        <version>${version.org.kie.kogito}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-drools-model</artifactId>
        <version>${version.org.kie.kogito}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-quarkus-rules</artifactId>
        <version>${version.org.kie.kogito}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>kogito-quarkus-rules-deployment</artifactId>
        <version>${version.org.kie.kogito}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.kogito</groupId>
        <artifactId>drools-core-dynamic</artifactId>
        <version>${version.org.kie.kogito}</version>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-internal</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-canonical-model</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-model-compiler</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-core</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-core-dynamic</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-decisiontables</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-alphanetwork-compiler</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>

      <!-- Normal dependencies versions-->
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>${version.ch.qos.logback}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${version.ch.qos.logback}</version>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${version.commons-io}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${version.com.fasterxml.jackson.core}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${version.com.fasterxml.jackson.core}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${version.com.fasterxml.jackson.core}</version>
      </dependency>
      <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${version.com.h2database}</version>
      </dependency>
      <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>${version.com.thoughtworks.xstream}</version>
      </dependency>
      <dependency>
        <groupId>jakarta.json.bind</groupId>
        <artifactId>jakarta.json.bind-api</artifactId>
        <version>${version.jakarta.json.bind}</version>
      </dependency>
      <dependency>
        <groupId>jakarta.xml.bind</groupId>
        <artifactId>jakarta.xml.bind-api</artifactId>
        <version>${version.jakarta.xml.bind}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${version.org.apache.commons.lang3}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-math3</artifactId>
        <version>${version.org.apache.commons.math3}</version>
      </dependency>
      <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>
        <exclusions>
          <exclusion>
            <!-- Collides with 'javax.xml.stream:stax-api' brought in by 'org.drools:drools-decisiontables'. -->
            <groupId>stax</groupId>
            <artifactId>stax-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.json</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.org.assertj}</version>
      </dependency>
      <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>${version.org.freemarker}</version>
      </dependency>
      <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <!-- Keep the version of the API and the impl in sync. -->
        <version>${version.jakarta.xml.bind}</version>
      </dependency>
      <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${version.org.hibernate}</version>
      </dependency>
      <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${version.org.hibernate}</version>
      </dependency>
      <dependency>
        <groupId>org.jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>${version.org.jdom}</version>
      </dependency>
      <dependency>
        <groupId>org.jfree</groupId>
        <artifactId>jfreechart</artifactId>
        <version>${version.org.jfree.jfreechart}</version>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${version.org.junit}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${version.org.mockito}</version>
      </dependency>
      <dependency>
        <groupId>org.ow2.asm</groupId>
        <artifactId>asm</artifactId>
        <version>${version.org.ow2.asm}</version>
      </dependency>
      <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${version.org.postgresql}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.org.slf4j}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${version.org.springframework}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${version.org.springframework}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${version.org.springframework}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>${version.org.springframework.boot}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure-processor</artifactId>
        <version>${version.org.springframework.boot}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <version>${version.org.springframework.boot}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-test</artifactId>
        <version>${version.org.springframework.boot}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-test-autoconfigure</artifactId>
        <version>${version.org.springframework.boot}</version>
      </dependency>

      <!-- TODO Dependencies that must use a jakarta.* groupId instead in 8 https://issues.redhat.com/browse/PLANNER-2262 -->
      <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>javax.persistence-api</artifactId>
        <version>2.2</version>
      </dependency>
      <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>jakarta.json</artifactId>
        <version>1.1.6</version>
      </dependency>
      <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.json</artifactId>
        <!-- Old version until this issue is resolved: https://github.com/ImmobilienScout24/illegal-transitive-dependency-check/issues/30 -->
        <version>1.0.4</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.spec.javax.transaction</groupId>
        <artifactId>jboss-transaction-api_1.2_spec</artifactId>
        <version>1.1.1.Final</version>
      </dependency>

      <!-- TODO Dependencies that should maybe be removed/replaced in 8 https://issues.redhat.com/browse/PLANNER-2262 -->
      <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.moxy</artifactId>
        <version>2.7.6</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.narayana.jta</groupId>
        <artifactId>narayana-jta</artifactId>
        <version>5.9.0.Final</version>
      </dependency>
      <dependency>
        <groupId>org.eclipse</groupId>
        <artifactId>yasson</artifactId>
        <version>1.0.6</version>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-test-util</artifactId>
        <version>${version.org.kie7}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>org.ow2.asm</groupId>
              <artifactId>asm-analysis</artifactId>
              <version>6.2.1</version>
            </dependency>
            <dependency>
              <groupId>com.redhat.victims</groupId>
              <artifactId>enforce-victims-rule</artifactId>
              <version>1.3.4</version>
            </dependency>
            <dependency>
              <groupId>org.commonjava.maven.enforcer</groupId>
              <artifactId>enforce-managed-deps-rule</artifactId>
              <version>1.3</version>
            </dependency>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.0</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>enforce-no-logback-test-in-main</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireFilesDontExist>
                    <files>
                      <file>${project.basedir}/src/main/resources/logback-test.xml</file>
                      <file>${project.basedir}/src/main/filtered-resources/logback-test.xml</file>
                    </files>
                  </requireFilesDontExist>
                </rules>
              </configuration>
            </execution>
            <execution>
              <id>no-managed-deps</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireManagedDeps
                      implementation="org.commonjava.maven.enforcer.rule.EnforceManagedDepsRule">
                    <checkProfiles>true</checkProfiles>
                    <failOnViolation>true</failOnViolation>
                  </requireManagedDeps>
                </rules>
              </configuration>
            </execution>
            <execution>
              <id>ban-forbidden-dependencies</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <bannedDependencies>
                    <excludes combine.children="append">
                      <!-- Ban forbidden logging deps (we only use SLF4J + Logback) -->
                      <!-- In case of transitive dependency, exclude it and use 'org.slf4j:jcl-over-slf4j' instead -->
                      <exclude>commons-logging:commons-log*</exclude>
                      <!-- In case of transitive dependency, exclude it and use 'org.slf4j:log4j-over-slf4j' instead -->
                      <exclude>log4j:log4j</exclude>
                      <!-- In case of transitive dependency, exclude it and use 'org.javassist:javassist' instead -->
                      <exclude>javassist:javassist</exclude>
                      <exclude>org.apache.cxf:cxf-bundle-jaxrs</exclude>
                      <exclude>org.mockito:mockito-all</exclude><!-- Use mockito-core instead -->
                    </excludes>
                  </bannedDependencies>
                </rules>
                <fail>true</fail>
              </configuration>
            </execution>
            <execution>
              <id>ban-duplicated-classes</id>
              <!-- Currently disabled as it fails the build. See https://issues.redhat.com/browse/PLANNER-2261. -->
              <phase>none</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <banDuplicateClasses>
                    <ignoreClasses>
                      <!-- Duplicated by XStream's transitive deps, with very little chance to get properly fixed -->
                      <ignoreClass>org.xmlpull.v1.XmlPullParserException</ignoreClass>
                      <ignoreClass>org.xmlpull.v1.XmlPullParser</ignoreClass>
                      <!-- Bundled by both com.sun:tools and com.sun.xml.bind:jaxb-xjc. No easy way to exclude one of them. -->
                      <ignoreClass>org.relaxng.datatype.*</ignoreClass>
                      <!-- Duplicated in xml-apis:xml-apis:jar:1.4.01 and xerces:xercesImpl:jar:2.11.0.SP4. The class is identical
                           and there is very little chance this will get ever fixed. -->
                      <ignoreClass>org.w3c.dom.ElementTraversal</ignoreClass>
                      <ignoreClass>org.w3c.dom.UserDataHandler</ignoreClass>
                      <!-- Classes in javax.annotation package are just marker annotations used to aid the programmers.
                           These annotations do not influence the actual behavior of the code, so it's reasonable to
                           ignore them. Following dependencies contain these classes: 'com.google.code.findbugs:jsr305'
                           and 'com.google.code.findbugs:annotations'. -->
                      <ignoreClass>javax.annotation.*</ignoreClass>
                      <!-- ignoring java 9 compatible class for modules -->
                      <ignoreClass>module-info</ignoreClass>
                      <!-- ignoring multirelease jar classes -->
                      <ignoreClass>META-INF/versions/*</ignoreClass>
                    </ignoreClasses>
                    <dependencies>
                      <dependency>
                        <!-- quarkus-ide-launcher is a dependency of quarkus-core that they auto exclude during the build -->
                        <groupId>io.quarkus</groupId>
                        <artifactId>quarkus-ide-launcher</artifactId>
                        <ignoreClasses>
                          <ignoreClass>*</ignoreClass>
                        </ignoreClasses>
                      </dependency>
                    </dependencies>
                    <findAllDuplicates>true</findAllDuplicates>
                  </banDuplicateClasses>
                </rules>
                <fail>${enforcer.failOnDuplicatedClasses}</fail>
              </configuration>
            </execution>
            <execution>
              <id>no-duplicate-declared-dependencies</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <banDuplicatePomDependencyVersions/>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.revapi</groupId>
          <artifactId>revapi-maven-plugin</artifactId>
          <version>0.9.5</version>
          <dependencies>
            <dependency>
              <groupId>org.revapi</groupId>
              <artifactId>revapi-java</artifactId>
              <version>0.14.3</version>
            </dependency>
          </dependencies>
          <configuration>
            <checkDependencies>false</checkDependencies>
            <oldArtifacts>
              <artifact>${project.groupId}:${project.artifactId}:${revapi.oldOptaplannerVersion}</artifact>
            </oldArtifacts>
            <newArtifacts>
              <artifact>${project.groupId}:${project.artifactId}:${project.version}</artifact>
            </newArtifacts>
            <!-- By default revapi will check the oldArtifact against the currently executed build -->
            <analysisConfigurationFiles>
              <configurationFile>
                <path>src/build/revapi-config.json</path>
                <roots>
                  <root>filters</root>
                  <root>ignores</root>
                </roots>
              </configurationFile>
            </analysisConfigurationFiles>
            <failSeverity>potentiallyBreaking</failSeverity>
          </configuration>
          <executions>
            <execution>
              <id>check</id>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>
        <!-- Packaging -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <executions>
            <execution>
              <id>default-jar</id>
              <configuration>
                <archive>
                  <manifestEntries combine.children="append">
                    <Automatic-Module-Name>${java.module.name}</Automatic-Module-Name>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
            <execution>
              <id>test-jar</id>
              <goals>
                <goal>test-jar</goal>
              </goals>
              <configuration>
                <skipIfEmpty>true</skipIfEmpty>
                <excludes>
                  <exclude>**/logback-test.xml</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <archive>
              <manifest>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
            <excludes>
              <!-- Remove unnecessary metadata generated by the jaxb2-maven-plugin. -->
              <exclude>META-INF/JAXB/</exclude>
              <!-- Remove the intermediate benchmark XSD that is later merged with the solver XSD. -->
              <exclude>${schema.filename.benchmark}</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <configuration>
            <excludes>
              <!-- The JAXB nor XSD artifacts should not appear in the sources JAR either (see the maven-jar-plugin). -->
              <exclude>META-INF/JAXB/</exclude>
              <exclude>${schema.filename.benchmark}</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>2.0.0</version>
          <dependencies>
            <dependency>
              <!-- Required to generate the PDF file -->
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj-pdf</artifactId>
              <version>1.5.0</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${version.versions.plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.2.0</version>
          <configuration>
            <author>false</author>
            <failOnError>true</failOnError>
            <!--
                 Disabled to workaround the following issue on JDK 16+:
                 Warning:  javadoc: warning - The -footer option is no longer supported and will be ignored.

                 Since we do not add the footer ourselves, it must be the plugin itself.
                 Therefore until a new Javadoc plugin version is released, there is no better workaround.
            -->
            <!-- <failOnWarnings>true</failOnWarnings>-->
            <quiet>true</quiet>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <compilerArgs>
              <!-- Visit https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html
                   to learn more about javac warnings -->
              <arg>-Xmaxwarns</arg>
              <arg>100</arg>
              <arg>-Xlint</arg>
              <arg>-Xlint:-rawtypes</arg>
              <arg>-Xlint:-serial</arg>
              <arg>-Xlint:-unchecked</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${version.jacoco.plugin}</version>
          <executions>
            <execution>
              <id>jacoco-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
              <configuration>
                <append>true</append>
                <destFile>${jacoco.exec.file}</destFile>
                <excludes>
                  <!-- Instrumentation of classes generated by antlr fails due to exceeding method size limit. -->
                  <exclude>*Lexer</exclude>
                  <!--
                    JaCoCo adds a field to every class and as a result tests checking fields on test data classes fail.
                  -->
                  <exclude>org.optaplanner.core.impl.testdata.domain.*</exclude>
                  <exclude>*TestdataAbstractSolutionBasedSolution</exclude>
                </excludes>
                <propertyName>jacoco.agent.argLine</propertyName>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>net.revelc.code.formatter</groupId>
          <artifactId>formatter-maven-plugin</artifactId>
          <version>2.11.0</version>
          <dependencies>
            <dependency>
              <groupId>org.optaplanner</groupId>
              <artifactId>optaplanner-ide-config</artifactId>
              <version>${project.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <configFile>eclipse-format.xml</configFile>
            <lineEnding>LF</lineEnding>
            <skip>${formatter.skip}</skip>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>${formatter.goal}</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>net.revelc.code</groupId>
          <artifactId>impsort-maven-plugin</artifactId>
          <version>1.4.1</version>
          <configuration>
            <groups>java.,javax.,org.,com.</groups>
            <staticGroups>*</staticGroups>
            <!-- keep in sync with the formatter-maven-plugin -->
            <skip>${formatter.skip}</skip>
            <removeUnused>true</removeUnused>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>${impsort.goal}</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>jaxb2-maven-plugin</artifactId>
          <version>2.5.0</version>
          <executions>
            <execution>
              <id>schemagen</id>
              <!-- Make sure the XSD will be generated after the codebase has been successfully compiled. -->
              <phase>process-classes</phase>
              <goals>
                <goal>schemagen</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <clearOutputDir>false</clearOutputDir>
            <createJavaDocAnnotations>false</createJavaDocAnnotations>
            <generateEpisode>false</generateEpisode>
            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
            <transformSchemas>
              <transformSchema>
                <uri>https://www.optaplanner.org/xsd/solver</uri>
                <toFile>solver.xsd</toFile>
              </transformSchema>
              <transformSchema>
                <uri>https://www.optaplanner.org/xsd/benchmark</uri>
                <toFile>${schema.filename.benchmark}</toFile>
              </transformSchema>
            </transformSchemas>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>net.revelc.code</groupId>
        <artifactId>impsort-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
      <!-- Do not move to full profile. Otherwise upstream Kogito dependency changes can break our build without Kogito CI catching it. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze-only</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <configuration>
              <failOnWarning>true</failOnWarning>
              <ignoreNonCompile>true</ignoreNonCompile>
              <verbose>true</verbose>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>

    <profile>
      <id>run-code-coverage</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <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>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- Fail the build in CI if code does not follow the standards. -->
      <id>validate-formatting-ci</id>
      <activation>
        <property>
          <name>env.CI</name>
        </property>
      </activation>
      <properties>
        <formatter.goal>validate</formatter.goal>
        <impsort.goal>check</impsort.goal>
      </properties>
    </profile>
    <profile>
      <!-- Mutation coverage disabled by default (use -Dmutation-coverage to activate it) -->
      <id>mutation-coverage</id>
      <activation>
        <property>
          <name>mutation-coverage</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.pitest</groupId>
              <artifactId>pitest-maven</artifactId>
              <version>1.2.0</version>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>
            <executions>
              <execution>
                <id>default-pitest</id>
                <phase>verify</phase>
                <goals>
                  <goal>mutationCoverage</goal>
                </goals>
                <configuration>
                  <reportsDirectory>local/pit-reports</reportsDirectory>
                  <timestampedReports>true</timestampedReports>
                  <timeoutConstant>1000</timeoutConstant>
                  <mutators>
                    <!--
                    <mutator>CONDITIONALS_BOUNDARY</mutator>
                    <mutator>NEGATE_CONDITIONALS</mutator>
                    <mutator>MATH</mutator>
                    <mutator>INCREMENTS</mutator>
                    <mutator>INVERT_NEGS</mutator>
                    <mutator>RETURN_VALS</mutator>
                    <mutator>VOID_METHOD_CALLS</mutator>
                    -->
                    <mutator>DEFAULTS</mutator>
                    <mutator>NON_VOID_METHOD_CALLS</mutator>
                    <mutator>REMOVE_CONDITIONALS</mutator>
                  </mutators>
                  <avoidCallsTo>java.lang.StringBuilder</avoidCallsTo>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>java11-specific-config</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <configuration>
                <release>${maven.compiler.release}</release>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <!--
      Creates JaCoCo XML reports and invokes the Sonar scanner, which uploads code quality data into the SonarCloud.
    -->
    <profile>
      <id>sonarcloud-analysis</id>
      <properties>
        <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.organization>kiegroup</sonar.organization>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.login>${env.SONARCLOUD_TOKEN}</sonar.login>
        <sonar.java.source>${maven.compiler.release}</sonar.java.source>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-aggregated-jacoco-report</id>
                <phase>validate</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <!--
                    Jacoco ant "report" task provides control over scope of the generated report. The report task
                    requires access to sources, classes and .exec file containing coverage data. The configuration
                    below uses sources and classes of the entire project (each of its modules) and a single jacoco.exec
                    file placed in project root directory.
                    Jacoco maven plugin does not provide such a level of control and requires an artificial module that
                    depends on all modules in the project to generate an aggregated report for all the modules.
                    This necessity of creating a reporting module in every project is rather intrusive.
                    See:
                    https://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html and
                    https://groups.google.com/forum/#!topic/jacoco/oMxNZs_DNII
                  -->
                  <target>
                    <echo message="Generating JaCoCo Reports"/>
                    <taskdef name="report" classname="org.jacoco.ant.ReportTask"/>
                    <mkdir dir="${project.reporting.outputDirectory}/jacoco"/>
                    <report>
                      <executiondata>
                        <fileset dir="${project.root.dir}/target">
                          <!--
                            Include a single jacoco.exec file, which should be used in append mode by every module.
                          -->
                          <include name="jacoco.exec"/>
                        </fileset>
                      </executiondata>
                      <structure name="Coverage Report">
                        <group name="${project.artifactId}">
                          <classfiles>
                            <fileset dir="${project.root.dir}">
                              <!--
                                Include class files from every module.
                              -->
                              <include name="**/target/classes/**/*.class"/>
                            </fileset>
                          </classfiles>
                          <sourcefiles encoding="UTF-8">
                            <fileset dir="${project.root.dir}">
                              <!--
                                Include source files from every module.
                              -->
                              <include name="**/src/main/**/*.java"/>
                            </fileset>
                          </sourcefiles>
                        </group>
                      </structure>
                      <!-- The same report is generated in each module -->
                      <xml destfile="${project.reporting.outputDirectory}/jacoco/jacoco.xml"/>
                    </report>
                  </target>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.jacoco</groupId>
                <artifactId>org.jacoco.ant</artifactId>
                <!-- Keep the version in sync with jacoco-maven-plugin -->
                <version>${version.jacoco.plugin}</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>3.7.0.1746</version>
            <executions>
              <execution>
                <goals>
                  <goal>sonar</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>sonarcloud-analysis-pull-request</id>
      <activation>
        <property>
          <name>env.ghprbPullId</name>
        </property>
      </activation>
      <properties>
        <sonar.pullrequest.provider>GitHub</sonar.pullrequest.provider>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.branch>${env.ghprbSourceBranch}</sonar.pullrequest.branch>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.key>${env.ghprbPullId}</sonar.pullrequest.key>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.base>${env.ghprbTargetBranch}</sonar.pullrequest.base>
      </properties>
    </profile>

    <profile>
      <id>quickProfile</id>
      <activation>
        <property>
          <name>quickly</name>
        </property>
      </activation>
      <properties>
        <enforcer.skip>true</enforcer.skip>
        <revapi.skip>true</revapi.skip>
        <skipTests>true</skipTests>
        <skipITs>true</skipITs>
        <formatter.skip>true</formatter.skip>
      </properties>
    </profile>

    <profile>
      <id>fullProfile</id>
      <activation>
        <property>
          <name>full</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin> <!-- Make sure the build fails-fast on Javadoc issues. -->
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>javadoc-javadoc</id>
                <phase>package</phase>
                <goals>
                  <goal>javadoc-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
