<?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>io.maestro3.job</groupId>
    <artifactId>m3-job-engine</artifactId>
    <version>0.2.0</version>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Job engine library.</description>
    <url>https://github.com/Maestro-Cloud-Control/m3-job-engine</url>

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

    <developers>
        <developer>
            <name>Karyna Filimonova</name>
            <email>oss.maestro3@gmail.com</email>
        </developer>
        <developer>
            <name>Serhii Akhmetshyn</name>
            <email>oss.maestro3@gmail.com</email>
        </developer>
        <developer>
            <name>Yevhen Nadin</name>
            <email>oss.maestro3@gmail.com</email>
        </developer>
        <developer>
            <name>Kyrylo Andreiev</name>
            <email>oss.maestro3@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/Maestro-Cloud-Control/m3-job-engine.git</connection>
        <developerConnection>scm:git:https://github.com/Maestro-Cloud-Control/m3-job-engine.git</developerConnection>
        <url>https://github.com/Maestro-Cloud-Control/m3-job-engine</url>
    </scm>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <apache.commons.version>3.20.0</apache.commons.version>
        <jackson.version>2.19.4</jackson.version>
        <slf4j.version>2.0.17</slf4j.version>

        <!-- Publishing -->
        <central.publishing.plugin.version>0.11.0</central.publishing.plugin.version>
        <maven.javadoc.plugin.version>3.12.0</maven.javadoc.plugin.version>
        <maven.source.plugin.version>3.4.0</maven.source.plugin.version>
        <maven.gpg.plugin.version>3.2.8</maven.gpg.plugin.version>

        <github.owner>Maestro-Cloud-Control</github.owner>
        <github.repository>m3-job-engine</github.repository>

        <central.autoPublish>false</central.autoPublish>
        <central.waitUntil>validated</central.waitUntil>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${apache.commons.version}</version>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Publish to GitHub Packages -->
        <profile>
            <id>github</id>

            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/${github.owner}/${github.repository}</url>
                </repository>
            </distributionManagement>
        </profile>

        <!-- Publish release artifacts to Maven Central -->
        <profile>
            <id>central</id>

            <build>
                <plugins>
                    <!-- Generates artifactId-version-sources.jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Generates artifactId-version-javadoc.jar -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Signs pom, jar, sources.jar and javadoc.jar -->
                    <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>

                    <!-- Uploads release bundle to Central Portal -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central.publishing.plugin.version}</version>
                        <extensions>true</extensions>

                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <deploymentName>${project.artifactId}-${project.version}</deploymentName>

                            <autoPublish>${central.autoPublish}</autoPublish>
                            <waitUntil>${central.waitUntil}</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
