<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.camunda.community</groupId>
        <artifactId>community-hub-release-parent</artifactId>
        <version>1.2.2</version>
        <relativePath />
    </parent>

    <groupId>org.camunda.bpm.extension</groupId>
    <artifactId>camunda-bpm-process-test-coverage-root</artifactId>
    <packaging>pom</packaging>
    <version>1.0.2</version>

    <name>Camunda BPM Process Test Coverage Root</name>
    <description>Helper library to visualize and assert which parts of a BPMN process have been covered by a test.
    </description>

    <modules>
        <module>extension</module>
        <module>starter</module>
        <module>bom</module>
    </modules>

    <properties>
        <version.java>1.8</version.java>
        <kotlin.version>1.6.10</kotlin.version>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <kotlin-logging.version>2.1.21</kotlin-logging.version>
    </properties>

    <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>io.github.microutils</groupId>
                <artifactId>kotlin-logging-jvm</artifactId>
                <version>${kotlin-logging.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <defaultGoal>clean install</defaultGoal>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.12.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.9.0</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>${version.java}</source>
                        <target>${version.java}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <shutdown>kill</shutdown>
                        <runOrder>random</runOrder>
                        <argLine>--illegal-access=permit -Djava.awt.headless=true -XX:+StartAttachListener -Xmx1024m
                        </argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <id>enforce-maven</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>3.6.0</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <!-- Kotlin compiler -->
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <version>${kotlin.version}</version>
                    <configuration>
                        <jvmTarget>${version.java}</jvmTarget>
                        <languageVersion>1.5</languageVersion>
                        <apiVersion>1.5</apiVersion>
                        <compilerPlugins>
                            <plugin>spring</plugin>
                            <plugin>no-arg</plugin>
                            <plugin>all-open</plugin>
                        </compilerPlugins>
                    </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>
                                <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>
            </plugins>
        </pluginManagement>

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

    <profiles>
        <profile>
            <id>examples</id>
            <activation>
                <property><name>!skipExamples</name></property>
            </activation>
            <modules>
                <module>examples</module>
            </modules>
        </profile>
        <profile>
            <id>activate-kotlin-support</id>
            <activation>
                <file>
                    <exists>src/main/kotlin</exists>
                </file>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.jetbrains.dokka</groupId>
                            <artifactId>dokka-maven-plugin</artifactId>
                            <version>1.6.10</version>
                            <executions>
                                <execution>
                                    <id>attach-javadocs</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>javadocJar</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <jdkVersion>11</jdkVersion>
                                <reportUndocumented>false</reportUndocumented>
                                <skipEmptyPackages>true</skipEmptyPackages>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>build-helper-maven-plugin</artifactId>
                            <version>3.3.0</version>
                            <executions>
                                <execution>
                                    <id>attach-kotlin-source</id>
                                    <phase>generate-sources</phase>
                                    <goals>
                                        <goal>add-source</goal>
                                    </goals>
                                    <configuration>
                                        <sources>
                                            <source>${project.basedir}/src/main/kotlin</source>
                                        </sources>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>attach-kotlin-test</id>
                                    <phase>generate-test-sources</phase>
                                    <goals>
                                        <goal>add-test-source</goal>
                                    </goals>
                                    <configuration>
                                        <sources>
                                            <source>${project.basedir}/src/test/kotlin</source>
                                        </sources>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <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>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </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:camunda-community-hub/camunda-process-test-coverage.git</connection>
        <url>scm:git:git@github.com:camunda-community-hub/camunda-process-test-coverage.git</url>
        <developerConnection>scm:git:git@github.com:camunda-community-hub/camunda-process-test-coverage.git
        </developerConnection>
        <tag>HEAD</tag>
    </scm>

</project>
