<?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>
    <artifactId>kogito-build-no-bom-parent</artifactId>
    <version>1.20.0.Final</version>
  </parent>

  <groupId>org.kie.kogito.examples</groupId>
  <artifactId>kogito-examples</artifactId>
  <packaging>pom</packaging>

  <name>Kogito Example</name>
  <description>Kogito Example</description>

  <url>http://kogito.kie.org</url>
  <inceptionYear>2019</inceptionYear>
  <organization>
    <name>JBoss by Red Hat</name>
    <url>http://www.jboss.org/</url>
  </organization>
  <licenses>
    <license>
      <name>Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <surefire.forkCount>1</surefire.forkCount>
    <failsafe.include>**/*IT.java</failsafe.include>
    <failsafe.exclude>**/Native*IT.java</failsafe.exclude>
    <alphanetworkCompilerEnabled>false</alphanetworkCompilerEnabled>
    <tests.category></tests.category>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <!-- kogito -->
    <kogito.version>${project.version}</kogito.version>
    <version.org.drools>8.20.0.Beta</version.org.drools>
    <version.org.optaplanner>8.20.0.Final</version.org.optaplanner>
    <!-- dependencies version -->
    <version.org.skyscreamer>1.5.0</version.org.skyscreamer>
    <!-- JKube -->
    <version.org.eclipse.jkube>1.4.0</version.org.eclipse.jkube>
    <!-- WebJars -->
    <version.org.webjars>4.5.3</version.org.webjars>
  </properties>

  <!-- distributionManagement section -->
  <distributionManagement>
    <repository>
      <id>jboss-releases-repository</id>
      <name>JBoss Releases Repository</name>
      <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>jboss-snapshots-repository</id>
      <name>JBoss Snapshot Repository</name>
      <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

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

  <pluginRepositories>
    <pluginRepository>
      <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>
    </pluginRepository>
  </pluginRepositories>

  <scm>
    <connection>scm:git:https://github.com/kiegroup/kogito-examples.git</connection>
    <developerConnection>scm:git:git@github.com:kiegroup/kogito-examples.git</developerConnection>
    <url>https://github.com/kiegroup/kogito-examples</url>
  </scm>

  <developers>
    <developer>
      <name>All developers are listed in the KIE GitHub organization</name>
      <url>https://github.com/orgs/kiegroup/people</url>
    </developer>
  </developers>

  <modules>
    <module>kogito-quarkus-examples</module>
    <module>kogito-springboot-examples</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>${version.org.webjars}</version>
        <scope>runtime</scope>
      </dependency>
      <dependency>
        <groupId>org.skyscreamer</groupId>
        <artifactId>jsonassert</artifactId>
        <version>${version.org.skyscreamer}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.5</version>
          <executions>
            <execution>
              <id>add-it-resources</id>
              <phase>pre-integration-test</phase>
              <goals>
                <goal>copy-resources</goal>
              </goals>
              <configuration>
                <outputDirectory>${project.build.directory}/test-run/META-INF</outputDirectory>
                <resources>
                  <resource>
                    <directory>target/classes/META-INF</directory>
                  </resource>
                </resources>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${version.surefire.plugin}</version>
          <configuration>
            <forkCount>${surefire.forkCount}</forkCount>
            <reuseForks>true</reuseForks>
            <includes>
              <include>${failsafe.include}</include>
            </includes>
            <excludes>
              <exclude>${failsafe.exclude}</exclude>
            </excludes>
            <systemPropertyVariables>
              <tests.category>${tests.category}</tests.category>
              <enable.resource.infinispan>${enable.resource.infinispan}</enable.resource.infinispan>
              <enable.resource.kafka>${enable.resource.kafka}</enable.resource.kafka>
              <enable.resource.postgresql>${enable.resource.postgresql}</enable.resource.postgresql>
              <enable.resource.mongodb>${enable.resource.mongodb}</enable.resource.mongodb>
              <container.image.keycloak>${container.image.keycloak}</container.image.keycloak>
              <container.image.infinispan>${container.image.infinispan}</container.image.infinispan>
              <container.image.kafka>${container.image.kafka}</container.image.kafka>
              <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
            </systemPropertyVariables>
            <classesDirectory>${project.build.outputDirectory}</classesDirectory>
            <workingDirectory>${project.build.directory}/test-run</workingDirectory>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </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>${maven.compiler.release}</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </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>
            <release>${maven.compiler.release}</release>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${version.surefire.plugin}</version>
          <configuration>
            <forkCount>${surefire.forkCount}</forkCount>
            <reuseForks>true</reuseForks>
            <runOrder>hourly</runOrder>
            <systemPropertyVariables>
              <tests.category>${tests.category}</tests.category>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.kie.kogito</groupId>
          <artifactId>kogito-maven-plugin</artifactId>
          <version>${project.version}</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>
            <!-- No OSGi manifestEntries for <goal>jar</goal>: if it supported, then felix has already added them -->
            <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>
                <archive>
                  <manifestEntries>
                    <Bundle-SymbolicName>${java.module.name}.tests</Bundle-SymbolicName>
                    <Bundle-Version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}</Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                  </manifestEntries>
                </archive>
              </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>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                    <Bundle-SymbolicName>${java.module.name}.source</Bundle-SymbolicName>
                    <Bundle-Version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}</Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                    <Eclipse-SourceBundle>${java.module.name};version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}";roots:="."</Eclipse-SourceBundle>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
            <execution>
              <id>attach-test-sources</id>
              <goals>
                <goal>test-jar-no-fork</goal>
              </goals>
              <configuration>
                <archive>
                  <manifestEntries>
                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                    <Bundle-SymbolicName>${java.module.name}.tests.source</Bundle-SymbolicName>
                    <Bundle-Version>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}</Bundle-Version>
                    <Bundle-Name>${project.name}</Bundle-Name>
                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                    <Eclipse-SourceBundle>${java.module.name}.tests;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}";roots:="."</Eclipse-SourceBundle>
                  </manifestEntries>
                </archive>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <!-- Image build / Kubernetes deployment -->
        <plugin>
          <groupId>org.eclipse.jkube</groupId>
          <artifactId>kubernetes-maven-plugin</artifactId>
          <version>${version.org.eclipse.jkube}</version>
        </plugin>
        <plugin>
          <groupId>org.eclipse.jkube</groupId>
          <artifactId>openshift-maven-plugin</artifactId>
          <version>${version.org.eclipse.jkube}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- need at least maven 3.8.1, fail fast with actionable error rather than obscure errors like [ Error injecting: private org.eclipse.aether.spi.log.Logger org.apache.maven.repository.internal.DefaultVersionRangeResolver.logger ] -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-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-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

</project>
