<?xml version="1.0" encoding="UTF-8"?>

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>ai.platon</groupId>
    <artifactId>distributed-lock</artifactId>
    <version>1.4.2</version>

    <packaging>pom</packaging>

    <name>Distributed Lock</name>
    <description>A Distributed Lock</description>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Alen Turković</name>
            <email>alturkovic@gmail.com</email>
            <organizationUrl>https://github.com/alturkovic</organizationUrl>
        </developer>
        <developer>
            <name>Vincent Zhang</name>
            <email>ivincent.zhang@gmail.com</email>
            <organization>platon.ai</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/platonai/distributed-lock.git</connection>
        <developerConnection>scm:git:ssh://github.com:platonai/distributed-lock.git</developerConnection>
        <url>https://github.com/platonai/distributed-lock</url>
    </scm>

    <repositories>
        <repository>
            <id>Central</id>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>

        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <modules>
        <module>distributed-lock-api</module>
        <module>distributed-lock-core</module>
        <module>distributed-lock-mongo</module>
        <module>distributed-lock-example</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>ai.platon</groupId>
                <artifactId>distributed-lock-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon</groupId>
                <artifactId>distributed-lock-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.platon</groupId>
                <artifactId>distributed-lock-mongo</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <sourceDirectory>src/main/kotlin</sourceDirectory>
        <testSourceDirectory>src/test/kotlin</testSourceDirectory>
    </build>

    <profiles>
        <profile>
            <id>platon-release</id>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka.version}</version>
                        <executions>
                            <execution>
                                <!-- generate javadoc.jar before package gpg plugin can generate asc for it -->
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <sourceDirectories>
                                <dir>${project.basedir}/src/main/java</dir>
                                <dir>${project.basedir}/src/main/kotlin</dir>
                            </sourceDirectories>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Override parent pom's javadoc settings, skip generating javadoc, use kdoc instead -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Skip maven-deploy-plugin to use nexus-staging-maven-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <!-- We want to sign the artifact, the POM, and all attached artifacts -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <javac.src.version>11</javac.src.version>
        <javac.target.version>8</javac.target.version>
        <!--  Kotlin  -->
        <kotlin.version>1.4.31</kotlin.version>
        <dokka.version>1.4.32</dokka.version>
    </properties>
</project>
