<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.cibseven.community</groupId>
    <artifactId>release-parent</artifactId>
    <version>1.1.0</version>
    <!-- do not remove empty tag -->
    <relativePath />
  </parent>

  <groupId>org.cibseven.community.data</groupId>
  <artifactId>cibseven-bpm-data-parent</artifactId>
  <version>2.1.0</version>

  <name>${project.artifactId}</name>
  <description>CIB seven BPM Data</description>
  <url>https://github.com/cibseven-community-hub/cibseven-bpm-data/</url>
  <packaging>pom</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>17</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <version.java>${java.version}</version.java>

    <cibseven.version>2.1.0</cibseven.version>

    <spring-boot.version>3.5.6</spring-boot.version>
    <spin.version>${cibseven.version}</spin.version>
    <cibseven-assert.version>${cibseven.version}</cibseven-assert.version>

    <kotlin.version>2.2.21</kotlin.version>
    <jgiven.version>2.0.3</jgiven.version>
    <kotlin.compiler.incremental>true</kotlin.compiler.incremental>

    <kotlin-logging.version>7.0.13</kotlin-logging.version>
    <mockito-kotlin.version>6.1.0</mockito-kotlin.version>

    <pattern.class.itest>%regex[.*ITest.*]</pattern.class.itest>

    <!-- Skip instrumentalization by default -->
    <jacoco.skip>true</jacoco.skip>
    <!-- Skip KDoc by default -->
    <dokka.skip>true</dokka.skip>
  </properties>

  <modules>
    <module>extension/core</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <!-- Kotlin -->
      <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-bom</artifactId>
        <version>${kotlin.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

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

      <dependency>
        <groupId>io.github.oshai</groupId>
        <artifactId>kotlin-logging-jvm</artifactId>
        <version>${kotlin-logging.version}</version>
      </dependency>

      <dependency>
        <groupId>org.cibseven.spin</groupId>
        <artifactId>cibseven-spin-bom</artifactId>
        <scope>import</scope>
        <type>pom</type>
        <version>${spin.version}</version>
      </dependency>
      <dependency>
        <groupId>org.cibseven.bpm.springboot</groupId>
        <artifactId>cibseven-bpm-spring-boot-starter-test</artifactId>
        <version>${cibseven.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito.kotlin</groupId>
        <artifactId>mockito-kotlin</artifactId>
        <version>${mockito-kotlin.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- Nullable / NotNull -->
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
      <version>26.0.2</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>clean jacoco:prepare-agent package</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <!-- cleaning -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>

        <!-- Coverage metering -->
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.13</version>
          <executions>
            <execution>
              <id>pre-unit-test</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>pre-integration-test</id>
              <goals>
                <goal>prepare-agent-integration</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!-- Kotlin compiler -->
          <artifactId>kotlin-maven-plugin</artifactId>
          <groupId>org.jetbrains.kotlin</groupId>
          <version>${kotlin.version}</version>
          <configuration>
            <languageVersion>2.2</languageVersion>
            <apiVersion>2.2</apiVersion>
            <jvmTarget>${java.version}</jvmTarget>
            <compilerPlugins>
              <plugin>spring</plugin>
              <plugin>no-arg</plugin>
              <plugin>all-open</plugin>
            </compilerPlugins>
            <pluginOptions>
              <!-- Each annotation is placed on its own line -->
              <option>all-open:annotation=com.tngtech.jgiven.integration.spring.JGivenStage</option>
            </pluginOptions>
          </configuration>
          <executions>
            <execution>
              <id>compile</id>
              <goals>
                <goal>compile</goal>
              </goals>
              <configuration>
                <sourceDirs>
                  <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                  <sourceDir>${project.basedir}/src/main/java</sourceDir>
                </sourceDirs>
              </configuration>
            </execution>
            <execution>
              <id>test-compile</id>
              <goals>
                <goal>test-compile</goal>
              </goals>
              <configuration>
                <skip>${maven.test.skip}</skip>
                <sourceDirs>
                  <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                  <sourceDir>${project.basedir}/src/test/java</sourceDir>
                </sourceDirs>
              </configuration>
            </execution>
          </executions>

          <dependencies>
            <dependency>
              <groupId>org.jetbrains.kotlin</groupId>
              <artifactId>kotlin-maven-allopen</artifactId>
              <version>${kotlin.version}</version>
            </dependency>
            <dependency>
              <groupId>org.jetbrains.kotlin</groupId>
              <artifactId>kotlin-maven-noarg</artifactId>
              <version>${kotlin.version}</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <!-- Java compiler -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.0</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
            <source>${maven.compiler.source}</source>
            <target>${maven.compiler.target}</target>
          </configuration>
          <executions>
            <!-- Replacing default-compile as it is treated specially by maven -->
            <execution>
              <id>default-compile</id>
              <phase>none</phase>
            </execution>
            <!-- Replacing default-testCompile as it is treated specially by maven -->
            <execution>
              <id>default-testCompile</id>
              <phase>none</phase>
            </execution>
            <execution>
              <id>java-compile</id>
              <phase>compile</phase>
              <goals>
                <goal>compile</goal>
              </goals>
            </execution>
            <execution>
              <id>java-test-compile</id>
              <phase>test-compile</phase>
              <goals>
                <goal>testCompile</goal>
              </goals>
              <configuration>
                <skip>${maven.test.skip}</skip>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!-- resources -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>

        <!-- Unit Tests -->
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.3</version>
          <configuration>
            <useSystemClassLoader>false</useSystemClassLoader>
            <shutdown>kill</shutdown>
            <runOrder>random</runOrder>
            <excludes>
              <exclude>${pattern.class.itest}</exclude>
            </excludes>
            <!-- Sets the VM argument line used when unit tests are run. -->
            <!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
            <argLine>-Djava.awt.headless=true @{argLine} -XX:+StartAttachListener</argLine>
            <systemPropertyVariables>
              <jgiven.report.dir>${project.build.directory}/jgiven-reports</jgiven.report.dir>
            </systemPropertyVariables>
          </configuration>
        </plugin>

        <!-- ITests -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.5.3</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <includes>
              <include>${pattern.class.itest}</include>
            </includes>
            <!-- Sets the VM argument line used when unit tests are run. -->
            <!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
            <argLine>-Djava.awt.headless=true @{argLine} -XX:+StartAttachListener</argLine>
            <runOrder>random</runOrder>
          </configuration>
        </plugin>


        <!-- JavaDoc for Java and KDoc for Kotlin -->
        <plugin>
          <groupId>org.jetbrains.dokka</groupId>
          <artifactId>dokka-maven-plugin</artifactId>
          <version>2.0.0</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <phase>package</phase>
              <goals>
                <goal>dokka</goal>
                <goal>javadocJar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skip>${dokka.skip}</skip>
            <includes>
              <include>${project.basedir}/src/main/kotlin/packages.md</include>
            </includes>
            <sourceLinks>
              <link>
                <path>${project.basedir}</path>
                <url>https://github.com/cibseven-community-hub/cibseven-bpm-data/blob/main</url>
                <lineSuffix>#L</lineSuffix>
              </link>
            </sourceLinks>
            <jdkVersion>17</jdkVersion>
            <sourceDirectories>
              <dir>${project.basedir}/src/main/kotlin</dir>
              <dir>${project.basedir}/src/main/java</dir>
            </sourceDirectories>
          </configuration>
        </plugin>
        <!-- Source from kotlin -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.6.0</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>${project.basedir}/src/main/kotlin</source>
                </sources>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <!-- gitflow -->
        <plugin>
          <groupId>com.amashchenko.maven.plugin</groupId>
          <artifactId>gitflow-maven-plugin</artifactId>
          <version>1.21.0</version>
          <configuration>
            <gitFlowConfig>
              <productionBranch>master</productionBranch>
              <developmentBranch>develop</developmentBranch>
              <featureBranchPrefix>feature/</featureBranchPrefix>
              <releaseBranchPrefix>release/</releaseBranchPrefix>
              <hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
              <supportBranchPrefix>support/</supportBranchPrefix>
              <origin>origin</origin>
            </gitFlowConfig>
            <useSnapshotInHotfix>true</useSnapshotInHotfix>
            <useSnapshotInRelease>true</useSnapshotInRelease>
            <keepBranch>false</keepBranch>
            <pushRemote>true</pushRemote>
          </configuration>
        </plugin>

        <!-- Enforce -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.5.0</version>
          <executions>
            <execution>
              <id>enforce-maven</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.9.0</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>17</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
    </plugins>

  </build>

  <profiles>
    <profile>
      <id>itest</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <!-- Skip Unit test execution on ITest profile run -->
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--
      Profile creating all artifacts: JARs, POMs, Sources, JavaDoc and all signatures.
    -->
    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jetbrains.dokka</groupId>
            <artifactId>dokka-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!--
      Profile for building examples and metering coverage
      -->
      <id>examples</id>
      <activation>
        <property>
          <name>!skipExamples</name>
        </property>
      </activation>
      <modules>
        <module>example</module>
      </modules>
    </profile>
  </profiles>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:cibseven-community-hub/cibseven-bpm-data.git</connection>
    <url>scm:git:git@github.com:cibseven-community-hub/cibseven-bpm-data.git</url>
    <developerConnection>scm:git:git@github.com:cibseven-community-hub/cibseven-bpm-data.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <pluginRepositories>
    <!-- required for Dokka (KDoc) and Orchid (Docs) -->
    <pluginRepository>
      <id>jcenter</id>
      <name>JCenter</name>
      <url>https://jcenter.bintray.com/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
    </pluginRepository>
  </pluginRepositories>

  <developers>
    <developer>
      <id>cibseven.org</id>
      <name>CIB seven Community</name>
      <email>community@cibseven.org</email>
      <url>http://cibseven.org</url>
      <organization>cibseven.org</organization>
      <organizationUrl>http://cibseven.org</organizationUrl>
    </developer>
    <developer>
      <name>Simon Zambrovski</name>
      <roles>
        <role>Product Owner</role>
        <role>Developer</role>
      </roles>
      <organization>Holisticon AG</organization>
      <organizationUrl>https://holisticon.de</organizationUrl>
    </developer>
    <developer>
      <name>Christian Maschmann</name>
      <roles>
        <role>Developer</role>
      </roles>
      <organization>Holisticon AG</organization>
      <organizationUrl>https://holisticon.de</organizationUrl>
    </developer>
    <developer>
      <name>Jan Galinski</name>
      <roles>
        <role>Developer</role>
      </roles>
      <organization>Holisticon AG</organization>
      <organizationUrl>https://holisticon.de</organizationUrl>
    </developer>
  </developers>

  <repositories>
    <repository>
      <id>mvn-cibseven-community</id>
      <name>CIB seven Community Repository</name>
      <url>https://artifacts.cibseven.org/repository/community</url>
    </repository>
    <repository>
      <id>mvn-cibseven-community-snapshots</id>
      <name>CIB seven Community Snapshots Repository</name>
      <url>https://artifacts.cibseven.org/repository/community-snapshots</url>
    </repository>
  </repositories>

</project>
