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

    <groupId>io.serverlessworkflow</groupId>
    <artifactId>serverlessworkflow-parent</artifactId>
    <version>7.12.0.Final</version>
    <packaging>pom</packaging>

    <name>Serverless Workflow :: Parent</name>
    <url>https://serverlessworkflow.io/sdk-java/</url>
    <description>Java SDK for Serverless Workflow Specification</description>
    <inceptionYear>2020</inceptionYear>
    <developers>
        <developer>
            <id>serverless-workflow</id>
            <name>Serverless Workflow Specification Authors</name>
            <organization>CNCF</organization>
        </developer>
    </developers>
    <organization>
        <name>CNCF</name>
        <url>https://www.cncf.io//</url>
    </organization>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git@github.com:serverlessworkflow/sdk-java.git</connection>
        <developerConnection>scm:git:git@github.com:serverlessworkflow/sdk-java.git</developerConnection>
        <url>https://github.com/serverlessworkflow/sdk-java</url>
        <tag>7.12.0.Final</tag>
    </scm>

    <modules>
        <module>api</module>
        <module>impl</module>
        <module>types</module>
        <module>annotations</module>
        <module>generators</module>
        <module>serialization</module>
        <module>experimental</module>
        <module>fluent</module>
        <module>mermaid</module>
        <module>bom</module>
    </modules>

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

        <!-- Plugin versions, please keep in alphabetical order -->
        <version.buildnumber.plugin>3.3.0</version.buildnumber.plugin>
        <version.checkstyle.plugin>3.6.0</version.checkstyle.plugin>
        <version.com.diffplug.spotless>3.2.1</version.com.diffplug.spotless>
        <version.compiler.plugin>3.15.0</version.compiler.plugin>
        <version.deploy.plugin>3.1.4</version.deploy.plugin>
        <version.enforcer.plugin>3.6.2</version.enforcer.plugin>
        <version.failsafe.plugin>3.5.4</version.failsafe.plugin>
        <version.gpg.plugin>3.2.8</version.gpg.plugin>
        <version.jar.plugin>3.5.0</version.jar.plugin>
        <version.jdk>${java.version}</version.jdk>
        <version.jsonschema2pojo-maven-plugin>1.3.1</version.jsonschema2pojo-maven-plugin>
        <version.javadoc.plugin>3.12.0</version.javadoc.plugin>
        <version.org.codehaus.mojo>3.6.3</version.org.codehaus.mojo>
        <version.org.sonatype.central>0.10.0</version.org.sonatype.central>
        <version.release.plugin>3.3.1</version.release.plugin>
        <version.source.plugin>3.4.0</version.source.plugin>
        <version.surefire.plugin>3.5.4</version.surefire.plugin>
        <version.nexus.plugin>1.7.0</version.nexus.plugin>
        <version.eu.maveniverse.maven.plugins>1.3.2</version.eu.maveniverse.maven.plugins>


        <!-- Dependencies versions, please keep in alphabetical order -->
        <version.awaitility>4.3.0</version.awaitility>
        <version.ch.qos.logback>1.5.27</version.ch.qos.logback>
        <version.com.fasterxml.jackson>2.21.0</version.com.fasterxml.jackson>
        <version.com.fasterxml.jackson.annotations>2.21</version.com.fasterxml.jackson.annotations>
        <version.com.networknt>2.0.0</version.com.networknt>
        <version.com.squareup.okhttp3.mockwebserver>5.3.2</version.com.squareup.okhttp3.mockwebserver>
        <version.io.cloudevents>4.0.1</version.io.cloudevents>
        <version.jakarta.validation>3.1.1</version.jakarta.validation>
        <version.jsonassert>1.5.2</version.jsonassert>
        <version.org.assertj>3.27.7</version.org.assertj>
        <version.org.junit.jupiter>6.0.2</version.org.junit.jupiter>
        <version.org.mockito>5.21.0</version.org.mockito>
        <version.org.slf4j>2.0.17</version.org.slf4j>
        <version.org.hibernate.validator>9.1.0.Final</version.org.hibernate.validator>
        <version.org.glassfish.expressly>6.0.0</version.org.glassfish.expressly>
        <!-- Checkstyle props -->
        <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
        <checkstyle.header.extensions>java</checkstyle.header.extensions>
        <checkstyle.logViolationsToConsole>true</checkstyle.logViolationsToConsole>

        <integration-tests.includes>**/*IT.java</integration-tests.includes>

        <rootDir>${maven.multiModuleProjectDirectory}</rootDir>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!--
                Import Jackson BOM to align all Jackson modules
                Glassfish also has dependency to Jackson, so to avoid incompatibility we force
                our required version to it.
            -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${version.com.fasterxml.jackson}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${version.com.fasterxml.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${version.com.fasterxml.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-yaml</artifactId>
                <version>${version.com.fasterxml.jackson}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${version.com.fasterxml.jackson.annotations}</version>
            </dependency>
            <dependency>
                <groupId>io.cloudevents</groupId>
                <artifactId>cloudevents-core</artifactId>
                <version>${version.io.cloudevents}</version>
            </dependency>
            <dependency>
                <groupId>io.cloudevents</groupId>
                <artifactId>cloudevents-json-jackson</artifactId>
                <version>${version.io.cloudevents}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.org.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${version.org.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>io.serverlessworkflow</groupId>
                <artifactId>serverlessworkflow-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.serverlessworkflow</groupId>
                <artifactId>serverlessworkflow-types</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.serverlessworkflow</groupId>
                <artifactId>serverlessworkflow-serialization</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.serverlessworkflow</groupId>
                <artifactId>serverlessworkflow-annotations</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.networknt</groupId>
                <artifactId>json-schema-validator</artifactId>
                <version>${version.com.networknt}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.validator</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${version.org.hibernate.validator}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.expressly</groupId>
                <artifactId>expressly</artifactId>
                <version>${version.org.glassfish.expressly}</version>
            </dependency>
            <dependency>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-core</artifactId>
                <version>${version.jsonschema2pojo-maven-plugin}</version>
            </dependency>
            <dependency>
                <groupId>jakarta.validation</groupId>
                <artifactId>jakarta.validation-api</artifactId>
                <version>${version.jakarta.validation}</version>
            </dependency>

            <!-- test -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${version.org.junit.jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${version.org.mockito}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${version.ch.qos.logback}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>mockwebserver</artifactId>
                <version>${version.com.squareup.okhttp3.mockwebserver}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${version.org.assertj}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility</artifactId>
                <version>${version.awaitility}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${version.org.sonatype.central}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>true</autoPublish>
                    <waitUntil>uploaded</waitUntil>
                </configuration>
            </plugin>
            <!-- Set properties containing the scm revision -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>${version.buildnumber.plugin}</version>
                <executions>
                    <execution>
                        <id>get-scm-revision</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
                            <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${version.compiler.plugin}</version>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <parameters>true</parameters>
                    <compilerArgs>
                        <arg>-Xlint:unchecked</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <checkstyleRules>
                        <module name="Checker">
                            <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>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <configuration>
                    <java>
                        <!-- formatter -->
                        <googleJavaFormat version="1.17.0" />
                        <!-- add/normalize headers -->
                        <licenseHeader>
                            <content>
                                <![CDATA[
/*
 * Copyright 2020-Present The Serverless Workflow Specification Authors
 *
 * 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.
 */
        ]]>
                            </content>
                        </licenseHeader>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-apply-on-validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>spotless-check-on-verify</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${version.gpg.plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.deploy.plugin}</version>
                    <configuration>
                        <retryFailedDeploymentCount>10</retryFailedDeploymentCount>
                    </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>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.source.plugin}</version>
                    <configuration>
                        <archive>
                            <index>true</index>
                            <manifest>
                                <addDefaultSpecificationEntries>
                                    true
                                </addDefaultSpecificationEntries>
                                <addDefaultImplementationEntries>
                                    true
                                </addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-URL>${project.url}</Implementation-URL>
                                <Java-Version>${java.version}</Java-Version>
                                <Java-Vendor>${java.vendor}</Java-Vendor>
                                <Os-Name>${os.name}</Os-Name>
                                <Os-Arch>${os.arch}</Os-Arch>
                                <Os-Version>${os.version}</Os-Version>
                                <Scm-Url>${project.scm.url}</Scm-Url>
                                <Scm-Connection>${project.scm.connection}</Scm-Connection>
                                <Scm-Revision>${buildNumber}</Scm-Revision>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${version.release.plugin}</version>
                    <configuration>
                        <preparationGoals>clean install -DperformRelease</preparationGoals>
                        <arguments>-Prelease -DperformRelease</arguments>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>@{project.version}</tagNameFormat>
                        <pushChanges>false</pushChanges>
                        <localCheckout>true</localCheckout>
                        <remoteTagging>false</remoteTagging>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jsonschema2pojo</groupId>
                    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                    <version>${version.jsonschema2pojo-maven-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <configuration>
                        <argLine>-Xmx1024m -XX:+IgnoreUnrecognizedVMOptions -XX:MaxPermSize=256m</argLine>
                        <excludes>
                            <exclude>${integration-tests.includes}</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.failsafe.plugin}</version>
                    <configuration>
                        <argLine>-Xmx1024m -XX:+IgnoreUnrecognizedVMOptions -XX:MaxPermSize=256m</argLine>
                        <includes>
                            <include>${integration-tests.includes}</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>com.diffplug.spotless</groupId>
                    <artifactId>spotless-maven-plugin</artifactId>
                    <version>${version.com.diffplug.spotless}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.jar.plugin}</version>
                    <configuration>
                        <archive>
                            <index>true</index>
                            <manifest>
                                <addDefaultSpecificationEntries>
                                    true
                                </addDefaultSpecificationEntries>
                                <addDefaultImplementationEntries>
                                    true
                                </addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-URL>${project.url}</Implementation-URL>
                                <Java-Version>${java.version}</Java-Version>
                                <Java-Vendor>${java.vendor}</Java-Vendor>
                                <Os-Name>${os.name}</Os-Name>
                                <Os-Arch>${os.arch}</Os-Arch>
                                <Os-Version>${os.version}</Os-Version>
                                <Scm-Url>${project.scm.url}</Scm-Url>
                                <Scm-Connection>${project.scm.connection}</Scm-Connection>
                                <Scm-Revision>${buildNumber}</Scm-Revision>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.javadoc.plugin}</version>
                    <configuration>
                        <failOnError>false</failOnError>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${version.org.codehaus.mojo}</version>
                </plugin>
                <plugin>
                    <groupId>eu.maveniverse.maven.plugins</groupId>
                    <artifactId>bom-builder3</artifactId>
                    <version>${version.eu.maveniverse.maven.plugins}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <profiles>
        <profile>
            <id>examples</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>!true</value>
                </property>
            </activation>
            <modules>
                <module>examples</module>
            </modules>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${version.source.plugin}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>run-integration-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
