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

    <groupId>net.jakobarndt.bpmnbacklink</groupId>
    <artifactId>bpmn-backlink-parent</artifactId>
    <version>0.1.0</version>
    <packaging>pom</packaging>

    <name>bpmn-backlink (parent)</name>
    <description>
        Maven tooling that links Camunda 7 BPMN service tasks to their Java delegates and
        records the mapping as a @CalledFrom annotation in the delegate source files.
    </description>
    <url>https://github.com/jjarndt/bpmn-backlink</url>

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

    <developers>
        <developer>
            <id>jjarndt</id>
            <name>Jakob Arndt</name>
            <url>https://github.com/jjarndt</url>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/jjarndt/bpmn-backlink.git</connection>
        <developerConnection>scm:git:git@github.com:jjarndt/bpmn-backlink.git</developerConnection>
        <url>https://github.com/jjarndt/bpmn-backlink</url>
        <tag>HEAD</tag>
    </scm>

    <modules>
        <module>bpmn-backlink-annotation</module>
        <module>bpmn-backlink-core</module>
        <module>bpmn-backlink-maven-plugin</module>
    </modules>

    <properties>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Dependency versions -->
        <camunda-bpmn-model.version>7.23.0</camunda-bpmn-model.version>
        <javaparser-core.version>3.26.2</javaparser-core.version>
        <maven-plugin-api.version>3.9.9</maven-plugin-api.version>
        <maven-core.version>3.9.9</maven-core.version>
        <maven-plugin-annotations.version>3.13.1</maven-plugin-annotations.version>
        <junit-jupiter.version>5.11.3</junit-jupiter.version>

        <!-- Build plugin versions -->
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <maven-plugin-plugin.version>3.13.1</maven-plugin-plugin.version>
        <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>

        <!-- Release plugin versions (Maven Central publishing) -->
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>

        <!-- Coverage gate: 100% line and branch per module bundle. -->
        <jacoco.line.ratio>1.00</jacoco.line.ratio>
        <jacoco.branch.ratio>1.00</jacoco.branch.ratio>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Internal modules -->
            <dependency>
                <groupId>net.jakobarndt.bpmnbacklink</groupId>
                <artifactId>bpmn-backlink-annotation</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>net.jakobarndt.bpmnbacklink</groupId>
                <artifactId>bpmn-backlink-core</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- BPMN Model API (Camunda Community, Apache-2.0) -->
            <dependency>
                <groupId>org.camunda.bpm.model</groupId>
                <artifactId>camunda-bpmn-model</artifactId>
                <version>${camunda-bpmn-model.version}</version>
            </dependency>

            <!-- Java source parsing -->
            <dependency>
                <groupId>com.github.javaparser</groupId>
                <artifactId>javaparser-core</artifactId>
                <version>${javaparser-core.version}</version>
            </dependency>

            <!-- Maven plugin development -->
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${maven-plugin-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${maven-core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>${maven-plugin-annotations.version}</version>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit-jupiter.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven-plugin-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <!-- HelpMojo is generated by maven-plugin-plugin; not our code. -->
                    <excludes>
                        <exclude>**/HelpMojo.*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${jacoco.line.ratio}</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${jacoco.branch.ratio}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
            Activated for releases to Maven Central: mvn -Prelease clean deploy
            Produces -sources and -javadoc jars, GPG-signs every artifact, and
            uploads the bundle through the Sonatype Central Portal.
        -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
