<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.kie.kogito</groupId>
    <!-- The Kogito Dependencies BOM is inherited here to reuse all the version properties defined there and used across our internal modules. -->
    <artifactId>kogito-dependencies-bom</artifactId>
    <version>1.37.0.Final</version>
    <relativePath>../kogito-dependencies-bom/pom.xml</relativePath>
  </parent>

  <artifactId>kogito-build-no-bom-parent</artifactId>
  <packaging>pom</packaging>

  <name>Kogito :: Runtimes Build No BOM Parent</name>
  <description>Kogito Runtimes Build No BOM Parent</description>

  <!--
      CONVENTIONS:
      - A version property must be specified in the format "version.{groupId}", optionally with a suffix to make it unique.
      - properties must be sorted alphabetically (other form of sorting were found to be unclear and ambiguous).
  -->
  <properties>
    <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
    <checkstyle.header.template><![CDATA[
^\/\*$\n^
\* Copyright \d\d\d\d Red Hat, Inc\. and\/or its affiliates\.$\n^
\*$\n^
\* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\);$\n^
\* you may not use this file except in compliance with the License\.$\n^
\* You may obtain a copy of the License at$\n^
\*$\n^
\*       http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0$\n^
\*$\n^
\* Unless required by applicable law or agreed to in writing, software$\n^
\* distributed under the License is distributed on an &quot;AS IS&quot; BASIS,$\n^
\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$\n^
\* See the License for the specific language governing permissions and$\n^
\* limitations under the License\.$\n^
\*\/$
]]>
    </checkstyle.header.template>
    <checkstyle.header.extensions>java,groovy</checkstyle.header.extensions>
    <checkstyle.logViolationsToConsole>true</checkstyle.logViolationsToConsole>

    <!-- container images for testing -->
    <container.image.infinispan>infinispan/server:${version.org.infinispan}</container.image.infinispan>
    <container.image.keycloak>quay.io/keycloak/keycloak:${version.org.keycloak}</container.image.keycloak>
    <container.image.kafka>vectorized/redpanda:v21.11.8</container.image.kafka>
    <container.image.wurstmeister.kafka>wurstmeister/kafka:${version.wurstmeister.kafka}</container.image.wurstmeister.kafka>
    <container.image.mongodb>library/mongo:${version.org.mongo-image}</container.image.mongodb>
    <container.image.redis>redislabs/redisearch:${version.org.redis}</container.image.redis>
    <container.image.postgres>postgres:${version.org.postgres}</container.image.postgres>

    <maven.compiler.release>11</maven.compiler.release>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <jacoco.agent.argLine/>
    <!--
      JaCoCo coverage data file location. Using a single file for appending in the project's root directory makes it
      possible to measure cross-module test coverage -->
    <jacoco.exec.file>${project.root.dir}/target/jacoco.exec</jacoco.exec.file>
    <!--suppress UnresolvedMavenProperty -->
    <project.root.dir>${maven.multiModuleProjectDirectory}</project.root.dir>
    <quarkus.logging.manager>org.jboss.logmanager.LogManager</quarkus.logging.manager>
    <tests.surefire.include>**/*Test.java</tests.surefire.include>
    <tests.failsafe.include>**/*IT.java</tests.failsafe.include>
    <formatter.skip>false</formatter.skip>
    <formatter.goal>format</formatter.goal>
    <impsort.goal>sort</impsort.goal>
    <version.jdk>11</version.jdk>
    <!-- Properties also affecting test execution. -->
    <invoker.skip>false</invoker.skip>
    <archetype.test.skip>false</archetype.test.skip>

    <!-- plugin versions -->
    <version.antapacheregexp>1.8.2</version.antapacheregexp>
    <version.antrun.plugin>1.8</version.antrun.plugin>
    <version.archetype.plugin>3.2.1</version.archetype.plugin>
    <version.asciidoctor.plugin>1.5.2.1</version.asciidoctor.plugin>
    <version.build.helper.plugin>3.0.0</version.build.helper.plugin>
    <version.clean.plugin>3.1.0</version.clean.plugin>
    <version.compiler.plugin>3.8.1</version.compiler.plugin>
    <version.copyrename.plugin>1.0</version.copyrename.plugin>
    <version.dependency.plugin>2.8</version.dependency.plugin>
    <version.de.skuzzle.enforcer>1.1.0</version.de.skuzzle.enforcer>
    <version.deploy.plugin>2.8.2</version.deploy.plugin>
    <version.enforcer.plugin>3.0.0-M2</version.enforcer.plugin>
    <version.exec.plugin>1.6.0</version.exec.plugin>
    <version.findbugs.plugin>3.0.5</version.findbugs.plugin>
    <version.install.plugin>2.5.2</version.install.plugin>
    <version.invoker.plugin>3.2.2</version.invoker.plugin>
    <version.jacoco.plugin>0.8.5</version.jacoco.plugin>
    <jandex-maven-plugin.group-id>io.smallrye</jandex-maven-plugin.group-id>
    <version.jandex.plugin>3.0.5</version.jandex.plugin>
    <version.jar.plugin>3.1.0</version.jar.plugin>
    <version.javancss.plugin>2.0</version.javancss.plugin>
    <version.jdocbook.plugin>2.3.9</version.jdocbook.plugin>
    <version.formatter.plugin>2.13.0</version.formatter.plugin>
    <version.impsort.plugin>1.8.0</version.impsort.plugin>
    <version.kr.motd.maven.os>1.6.0</version.kr.motd.maven.os>
    <version.license.plugin>4.0.rc2</version.license.plugin>
    <version.native2ascii.plugin>1.0-beta-1</version.native2ascii.plugin>
    <version.org.xolstice.maven.protobuf>0.6.1</version.org.xolstice.maven.protobuf>
    <version.plugin.plugin>3.6.0</version.plugin.plugin>
    <version.project.sources.plugin>0.3</version.project.sources.plugin>
    <version.rpkgtests.maven.plugin>1.0.0</version.rpkgtests.maven.plugin>
    <version.resources.plugin>3.1.0</version.resources.plugin>
    <version.site.plugin>3.7.1</version.site.plugin>
    <version.shade.plugin>3.0.0</version.shade.plugin>
    <version.sonar.plugin>3.6.1.1688</version.sonar.plugin>
    <version.source.plugin>3.0.1</version.source.plugin>
    <version.surefire.plugin>3.0.0-M5</version.surefire.plugin> <!-- minimum required by JUnit 5 -->
    <version.surefire.report.plugin>3.0.0-M5</version.surefire.report.plugin>
    <version.taglist.plugin>2.4</version.taglist.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>
    <version.org.jsonschema2pojo-maven-plugin>1.0.1</version.org.jsonschema2pojo-maven-plugin>
    <version.org.codehaus.gmavenplus.plugin>1.5</version.org.codehaus.gmavenplus.plugin>
  </properties>

  <build>
    <extensions>
        <extension>
            <groupId>kr.motd.maven</groupId>
            <artifactId>os-maven-plugin</artifactId>
            <version>${version.kr.motd.maven.os}</version>
        </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
            <groupId>org.xolstice.maven.plugins</groupId>
            <artifactId>protobuf-maven-plugin</artifactId>
            <version>${version.org.xolstice.maven.protobuf}</version>
            <configuration>
              <protocArtifact>com.google.protobuf:protoc:${version.com.google.protobuf}:exe:${os.detected.classifier}</protocArtifact>
              <protoSourceRoot>${basedir}/src/main/resources/</protoSourceRoot>
              <excludes>
                <exclude>META-INF/**</exclude>
              </excludes>
              <clearOutputDirectory>false</clearOutputDirectory>
              <outputDirectory>${basedir}/src/main/java</outputDirectory>
             </configuration>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${version.checkstyle.plugin}</version>
          <configuration>
            <checkstyleRules>
              <module name="Checker">
                <module name="RegexpHeader">
                  <property name="header" value="${checkstyle.header.template}"/>
                  <property name="fileExtensions" value="${checkstyle.header.extensions}"/>
                </module>
                <module name="TreeWalker">
                  <module name="RegexpSinglelineJava">
                    <property name="format" value="@author"/>
                    <property name="message" value="No @author tag allowed"/>
                  </module>
                </module>
              </module>
            </checkstyleRules>
            <outputFile>${project.build.directory}/checkstyle.log</outputFile>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <includeResources>true</includeResources>
            <includeTestResources>true</includeTestResources>
            <consoleOutput>false</consoleOutput>
            <failsOnError>false</failsOnError>
            <logViolationsToConsole>${checkstyle.logViolationsToConsole}</logViolationsToConsole>
            <failOnViolation>${checkstyle.failOnViolation}</failOnViolation>
            <sourceDirectories>
              <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
              <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
            </sourceDirectories>
          </configuration>
          <executions>
            <execution>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>${version.archetype.plugin}</version>
          <configuration>
            <skip>${archetype.test.skip}</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${version.enforcer.plugin}</version>
          <executions>
            <execution>
              <id>enforce-versions</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>${version.maven}</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>${version.jdk}</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${version.clean.plugin}</version>
          <executions>
            <execution>
              <id>default-clean</id>
              <phase>clean</phase>
              <goals>
                <goal>clean</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>${version.install.plugin}</version>
          <executions>
            <execution>
              <id>default-install</id>
              <phase>install</phase>
              <goals>
                <goal>install</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>${version.site.plugin}</version>
          <executions>
            <execution>
              <id>default-site</id>
              <phase>site</phase>
              <goals>
                <goal>site</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${version.dependency.plugin}</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${version.deploy.plugin}</version>
          <configuration>
            <retryFailedDeploymentCount>10</retryFailedDeploymentCount>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${version.compiler.plugin}</version>
          <configuration>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
            <release>${maven.compiler.release}</release>
            <compilerArgs>
              <arg>-Xlint:unchecked</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${version.antrun.plugin}</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.ant</groupId>
              <artifactId>ant-apache-regexp</artifactId>
              <version>${version.antapacheregexp}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${version.resources.plugin}</version>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${version.failsafe.plugin}</version>
          <executions>
            <execution>
              <id>integration-test</id>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <useModulePath>false</useModulePath>
            <includes>
              <include>${tests.failsafe.include}</include>
            </includes>
            <excludes>
              <exclude>${tests.surefire.include}</exclude>
            </excludes>
            <argLine>-Xms2048m -Xmx4g  -XX:-TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none</argLine>
            <systemPropertyVariables>
              <maven.repo.local>${session.request.localRepositoryPath.path}</maven.repo.local>
              <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
            </systemPropertyVariables>
            <parallel>all</parallel>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${version.surefire.plugin}</version>
          <configuration>
            <includes>
              <include>${tests.surefire.include}</include>
            </includes>
            <excludes>
              <exclude>${tests.failsafe.include}</exclude>
            </excludes>
            <argLine>-Xms2048m -Xmx4g -XX:-TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none -Dfile.encoding=UTF-8</argLine>
            <systemPropertyVariables>
              <apple.awt.UIElement>true</apple.awt.UIElement>
              <org.uberfire.nio.git.daemon.enabled>false</org.uberfire.nio.git.daemon.enabled>
              <org.uberfire.nio.git.ssh.enabled>false</org.uberfire.nio.git.ssh.enabled>
              <org.uberfire.sys.repo.monitor.disabled>true</org.uberfire.sys.repo.monitor.disabled>
              <maven.repo.local>${session.request.localRepositoryPath.path}</maven.repo.local>
              <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
            </systemPropertyVariables>
            <parallel>all</parallel>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${version.exec.plugin}</version>
        </plugin>
        <!-- Packaging -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${version.jar.plugin}</version>
          <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>
                  <exclude>**/jndi.properties</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <archive>
              <manifest>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${version.source.plugin}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
            <execution>
              <id>attach-test-sources</id>
              <goals>
                <goal>test-jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.commonjava.maven.plugins</groupId>
          <artifactId>project-sources-maven-plugin</artifactId>
          <version>${version.project.sources.plugin}</version>
          <executions>
            <execution>
              <id>project-sources-archive</id>
              <phase>initialize</phase>
              <goals>
                <goal>archive</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>${version.invoker.plugin}</version>
          <configuration>
            <skipInstallation>${skipTests}</skipInstallation>
            <skipInvocation>${skipTests}</skipInvocation>
            <failIfNoProjects>true</failIfNoProjects>
            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          </configuration>
        </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-release-plugin</artifactId>
          <configuration>
            <!-- Manually push changes (including git tags) after nexus staged repo is successfully closed -->
            <pushChanges>false</pushChanges>
            <autoVersionSubmodules>true</autoVersionSubmodules>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${version.license.plugin}</version>
          <configuration>
            <licenseSets>
              <licenseSet>
                <inlineHeader>
Copyright ${license.git.copyrightCreationYear} Red Hat, Inc. and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
                </inlineHeader>
                <includes>
                  <include>**/*.java</include>
                  <include>**/*.drl</include>
                </includes>
                <excludes>
                  <exclude>**/target/**</exclude>
                  <exclude>.mvn/**</exclude>
                  <exclude>**/node_modules/**</exclude>
                </excludes>
                <useDefaultExcludes>false</useDefaultExcludes>
                <properties>
                  <license.git.copyrightLastYearMaxCommitsLookup>100</license.git.copyrightLastYearMaxCommitsLookup>
                </properties>
              </licenseSet>
            </licenseSets>
            <mapping>
              <drl>JAVADOC_STYLE</drl>
            </mapping>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.mycila</groupId>
              <artifactId>license-maven-plugin-git</artifactId>
              <version>${version.license.plugin}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>net.revelc.code.formatter</groupId>
          <artifactId>formatter-maven-plugin</artifactId>
          <version>${version.formatter.plugin}</version>
          <dependencies>
            <dependency>
              <artifactId>kogito-ide-config</artifactId>
              <groupId>org.kie.kogito</groupId>
              <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>${version.impsort.plugin}</version>
          <configuration>
            <!-- keep in sync with kogito-build/kogito-ide-config/src/main/resources/eclipse.importorder -->
            <groups>java.,javax.,org.,com.,io.</groups>
            <staticGroups>*</staticGroups>
            <staticAfter>true</staticAfter>
            <!-- 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>findbugs-maven-plugin</artifactId>
          <version>${version.findbugs.plugin}</version>
          <configuration>
            <maxRank>6</maxRank>
            <effort>Max</effort>
            <xmlOutput>true</xmlOutput>
            <failOnError>${findbugs.failOnViolation}</failOnError>
            <excludeFilterFile>findbugs-excludes.xml</excludeFilterFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${version.plugin.plugin}</version>
        </plugin>
        <plugin>
          <groupId>${jandex-maven-plugin.group-id}</groupId>
          <artifactId>jandex-maven-plugin</artifactId>
          <version>${version.jandex.plugin}</version>
          <executions>
            <execution>
              <id>make-index</id>
              <goals>
                <goal>jandex</goal>
              </goals>
            </execution>
          </executions>
        </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>
                  <exclude>*Lexer</exclude>
                  <exclude>org.kie.kogito.codegen.data.*</exclude>
                </excludes>
                <propertyName>jacoco.agent.argLine</propertyName>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>${version.sonar.plugin}</version>
        </plugin>
        <plugin>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-maven-plugin</artifactId>
          <version>${version.io.quarkus}</version>
        </plugin>
        <plugin>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
          <version>${version.io.quarkus}</version>
        </plugin>
        <plugin>
          <groupId>org.jsonschema2pojo</groupId>
          <artifactId>jsonschema2pojo-maven-plugin</artifactId>
          <version>${version.org.jsonschema2pojo-maven-plugin}</version>
        </plugin>
        <plugin>
          <!-- The gmavenplus plugin is used to compile Groovy code. To learn more about this plugin,
          visit https://github.com/groovy/GMavenPlus/wiki -->
          <groupId>org.codehaus.gmavenplus</groupId>
          <artifactId>gmavenplus-plugin</artifactId>
          <version>${version.org.codehaus.gmavenplus.plugin}</version>
          <executions>
            <execution>
              <goals>
                <goal>compile</goal>
                <goal>testCompile</goal>
              </goals>
            </execution>
          </executions>
        </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>
        <!-- Entry needed to create test-jars even for packaging types war, bundle, ... -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <!-- Entry needed to create, install and deploy sources jars -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <!-- Note: It's not possible to configure reporting plugins in pluginManagement in m2.0.4 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>${version.surefire.report.plugin}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>report-only</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>javancss-maven-plugin</artifactId>
        <version>${version.javancss.plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>taglist-maven-plugin</artifactId>
        <version>${version.taglist.plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>productized</id>
      <activation>
        <property>
          <name>productized</name>
        </property>
      </activation>
      <properties>
        <jandex-maven-plugin.group-id>org.jboss.jandex</jandex-maven-plugin.group-id>
        <version.jandex.plugin>1.2.3</version.jandex.plugin>
      </properties>
    </profile>
    <profile>
      <id>run-code-coverage</id>
      <build>
        <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} -Xms1024m -Xmx4g  -XX:-TieredCompilation -XX:TieredStopAtLevel=1 -Xverify:none -Dfile.encoding=UTF-8</argLine>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- Fail the build if code does not follow the standards. -->
      <id>validate-formatting</id>
      <activation>
        <property>
          <name>validate-formatting</name>
        </property>
      </activation>
      <properties>
        <formatter.skip>false</formatter.skip>
        <formatter.goal>validate</formatter.goal>
        <impsort.goal>check</impsort.goal>
      </properties>
    </profile>

    <profile>
      <!-- Performs the quick build: all plugins deactivated -->
      <id>quick-build</id>
      <activation>
        <property>
          <name>quickly</name>
        </property>
      </activation>
      <properties>
        <formatter.skip>true</formatter.skip>
        <skipITs>true</skipITs>
        <skipTests>true</skipTests>
        <invoker.skip>true</invoker.skip>
        <archetype.test.skip>true</archetype.test.skip>
        <exec.skip>true</exec.skip>
      </properties>
      <build>
        <defaultGoal>clean install</defaultGoal>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>properties-maven-plugin</artifactId>
              <executions>
                <execution>
                  <phase>initialize</phase>
                  <goals>
                    <goal>set-system-properties</goal>
                  </goals>
                  <configuration>
                    <properties>
                      <property>
                        <name>quarkus.container-image.build</name>
                        <value>false</value>
                      </property>
                    </properties>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!-- Performs the quick test: only formatting validation and unit tests enabled -->
      <id>quick-test</id>
      <activation>
        <property>
          <name>quickTests</name>
        </property>
      </activation>
      <properties>
        <formatter.skip>false</formatter.skip>
        <formatter.goal>validate</formatter.goal>
        <impsort.goal>check</impsort.goal>
        <skipITs>true</skipITs>
        <invoker.skip>true</invoker.skip>
        <archetype.test.skip>true</archetype.test.skip>
        <exec.skip>true</exec.skip>
      </properties>
      <build>
        <defaultGoal>clean install</defaultGoal>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>properties-maven-plugin</artifactId>
              <executions>
                <execution>
                  <phase>initialize</phase>
                  <goals>
                    <goal>set-system-properties</goal>
                  </goals>
                  <configuration>
                    <properties>
                      <property>
                        <name>quarkus.container-image.build</name>
                        <value>false</value>
                      </property>
                    </properties>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-invoker-plugin</artifactId>
              <configuration>
                <skipInstallation>true</skipInstallation>
                <skipInvocation>true</skipInvocation>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!--
        Translates -DskipTests parameter passed to build into setting corresponding skip properties.
        It does NOT reflect the change made to the property value inside the pom files, just from cmd line.
        Inside pom file it needs to be in sync explicitly in each profile.
      -->
      <id>skip-tests</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <properties>
        <invoker.skip>true</invoker.skip>
        <archetype.test.skip>true</archetype.test.skip>
        <exec.skip>true</exec.skip>
      </properties>
    </profile>

    <profile>
      <!-- Profile that prints out effective property values for the execution. -->
      <id>development-echo-properties</id>
      <activation>
        <property>
          <name>echo-properties</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <property environment="env" />
                    <echoproperties />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </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.javascript.node.maxspace>4096</sonar.javascript.node.maxspace>
        <sonar.java.source>${maven.compiler.release}</sonar.java.source>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.login>${env.SONARCLOUD_TOKEN}</sonar.login>
        <sonar.organization>kiegroup</sonar.organization>
        <!-- KOGITO-4895 keep it here in exact form <sonar.exclusions></sonar.exclusions>,
          if removed exclusions are not scoped to a particular defining module.
        -->
        <sonar.exclusions></sonar.exclusions>
        <enforcer.skip>true</enforcer.skip>
        <checkstyle.skip>true</checkstyle.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <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"/>
                    <mkdir dir="${project.root.dir}/target"/>
                    <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"/>
                              <!-- To avoid a complaint about duplicate classes from archetypes. -->
                              <exclude name="**/target/test-classes/**/*.class"/>
                              <!-- To avoid a complaint about duplicate classes from archetype of Quarkus (test-compile) -->
                              <exclude name="**/target/test-compile/**/*.class"/>
                              <!-- To avoid a complaint about duplicate classes as KogitoProcessInstancesFactory.class is required in every persistence addon that is mutually exclusive. -->
                              <exclude name="**/target/classes/org/kie/kogito/persistence/KogitoProcessInstancesFactory.class"/>
                              <!-- To avoid a complaint about duplicate classes created by code generation. -->
                              <exclude name="**/target/classes/org/kie/kogito/app/**/*.class"/>
                              <exclude name="**/target/classes/org/drools/project/model/**/*.class"/>
                              <!-- To avoid a complaint about duplicate classes created by code generation in IT tests. -->
                              <exclude name="**/it/integration-tests-springboot-it/target/classes/**/*.class"/>
                              <exclude name="**/it/integration-tests-springboot-kakfa-it/target/classes/**/*.class"/>
                              <exclude name="**/it/integration-tests-kogito-plugin-it/target/classes/**/*.class"/>
                              <exclude name="**/apps-integration-tests/**/target/classes/**/*.class"/>
                              <exclude name="**/integration-tests/**/target/classes/**/*.class"/>
                              <exclude name="**/integration-test/**/target/classes/**/*.class"/>
                              <exclude name="**/integration-test-legacy/**/target/classes/**/*.class"/>
                              <exclude name="**/quarkus/cloudevents/integration-tests/target/classes/**/*.class"/>
                              <exclude name="**/it/cloudevents-spring-boot-addon-it-invoked/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>
            <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>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.base>${env.ghprbTargetBranch}</sonar.pullrequest.base>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.branch>${env.ghprbSourceBranch}</sonar.pullrequest.branch>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.key>${env.ghprbPullId}</sonar.pullrequest.key>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.pullrequest.github.repository>${env.ghprbPullLink}</sonar.pullrequest.github.repository>
        <sonar.pullrequest.provider>GitHub</sonar.pullrequest.provider>
      </properties>
    </profile>
  </profiles>
</project>
