<?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>me.o-r-e</groupId>
    <artifactId>k-poi-ext</artifactId>
    <version>0.0.2</version>
    <name>Apache POI extension (Kotlin)</name>
    <description>Some utility methods and variables for Apache POI (can shorten code), written in Kotlin</description>
    <url>https://github.com/o-r-e/k-poi-ext</url>

    <scm>
        <connection>scm:git:git://github.com/o-r-e/k-poi-ext.git</connection>
        <developerConnection>scm:git:ssh://github.com:o-r-e/k-poi-ext.git</developerConnection>
        <url>https://github.com/o-r-e/k-poi-ext/tree/master</url>
    </scm>

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

    <developers>
        <developer>
            <name>Obuhov Roman</name>
            <email>obuhov.r@gmail.com</email>
            <organization>Github</organization>
            <organizationUrl>https://github.com/o-r-e</organizationUrl>
        </developer>
    </developers>

    <properties>
        <java.target.version>8</java.target.version>
        <java.target.version.full>1.${java.target.version}</java.target.version.full>
        <maven.compiler.source>${java.target.version}</maven.compiler.source>
        <maven.compiler.target>${java.target.version}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <license.dir>${basedir}</license.dir>

        <dokka.version>1.5.0</dokka.version>
        <kotlin.version>1.5.30</kotlin.version>
        <poi.version>5.0.0</poi.version>
    </properties>

    <dependencies>
        <!-- org.apache.poi - poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi.version}</version>
        </dependency>

        <!-- org.jetbrains.kotlin - kotlin-stdlib-jdk8 -->
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>deploy</id>

            <properties>
                <gpg.keyname>0x4A670616</gpg.keyname>
            </properties>

            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub Obuhov R. Apache Maven Packages</name>
                    <url>https://maven.pkg.github.com/o-r-e/k-poi-ext</url>
                </repository>
                <!--<repository>
                    <id>ossrh</id>
                    <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>-->
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
            </distributionManagement>

            <build>
                <plugins>
                    <!-- org.apache.maven.plugins - maven-gpg-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>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- org.apache.maven.plugins - maven-javadoc-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- org.apache.maven.plugins - maven-source-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>

                        <executions>
                            <execution>
                                <id>sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- org.jetbrains.dokka - dokka-maven-plugin -->
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${dokka.version}</version>

                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>javadocJar</goal>
                                </goals>
                            </execution>
                        </executions>

                        <configuration>
                            <jdkVersion>${java.target.version}</jdkVersion>
                        </configuration>
                    </plugin>

                    <!-- org.sonatype.plugins - nexus-staging-maven-plugin -->
                    <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://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <!-- org.jetbrains.kotlin - kotlin-maven-plugin -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <configuration>
                    <jvmTarget>${java.target.version.full}</jvmTarget>
                    <args>
                        <arg>-Xopt-in=kotlin.contracts.ExperimentalContracts</arg>
                        <arg>-Xuse-ir</arg>
                    </args>
                </configuration>

                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
