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

    The MIT License
    Copyright © 2015 Pixel Outlaw

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!-- This module was also published with a richer model, Gradle metadata,  -->
    <!-- which should be used instead. Do not delete the following line which  -->
    <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
    <!-- that they should prefer consuming it instead. -->
    <!-- do_not_remove: published-with-gradle-metadata -->
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.pixeloutlaw</groupId>
    <artifactId>spigot-plugin-parent</artifactId>
    <version>1.17.1.6</version>
    <packaging>pom</packaging>

    <name>spigot-plugin-parent</name>
    <description>A parent project for Pixel Outlaw's Maven-based Spigot plugins.</description>

    <inceptionYear>2015</inceptionYear>
    <url>https://github.com/PixelOutlaw/spigot-plugin-parent</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.javaVersion>16</project.build.javaVersion>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
    </properties>

    <licenses>
        <license>
            <name>MIT</name>
            <distribution>repo</distribution>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>ToppleTheNun</id>
            <name>Richard Harrah</name>
            <email>topplethenunnery@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/PixelOutlaw/spigot-plugin-parent.git</connection>
        <developerConnection>scm:git:https://github.com/PixelOutlaw/spigot-plugin-parent.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/PixelOutlaw/spigot-plugin-parent</url>
    </scm>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-bom</artifactId>
                <version>1.5.21</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.17.1-R0.1-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.destroystokyo.paper</groupId>
                <artifactId>paper-api</artifactId>
                <version>1.17.1-R0.1-SNAPSHOT</version>
            </dependency>

            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.7.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2/</url>
        </repository>
        <repository>
            <id>spigotmc-snapshots</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>papermc-releases</id>
            <url>https://papermc.io/repo/repository/maven-releases</url>
        </repository>
        <repository>
            <id>papermc-snapshots</id>
            <url>https://papermc.io/repo/repository/maven-snapshots</url>
        </repository>
        <repository>
            <id>ossrh-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>jitpack</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <!-- Distribute to Maven Central -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <name>Central Repository OSSRH</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <name>Central Repository OSSRH</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <defaultGoal>install</defaultGoal>

        <resources>
            <resource>
                <targetPath>.</targetPath>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.0</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <header>com/mycila/maven/plugin/license/templates/MIT.txt</header>
                    <properties>
                        <owner>Pixel Outlaw</owner>
                        <email>topplethenunnery@gmail.com</email>
                    </properties>
                    <includes>
                        <include>pom.xml</include>
                        <include>src/main/java/com/tealcubegames/**</include>
                        <include>src/main/kotlin/com/tealcubegames/**</include>
                        <include>src/main/java/com/tealcube/**</include>
                        <include>src/main/kotlin/com/tealcube/**</include>
                        <include>src/main/java/io/pixeloutlaw/**</include>
                        <include>src/main/kotlin/io/pixeloutlaw/**</include>
                    </includes>
                    <excludes>
                        <exclude>**/README</exclude>
                        <exclude>src/test/resources/**</exclude>
                        <exclude>src/main/resources/**</exclude>
                    </excludes>
                    <useDefaultMapping>false</useDefaultMapping>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                        <kt>SLASHSTAR_STYLE</kt>
                        <xml>XML_STYLE</xml>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>1.5.21</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${project.build.javaVersion}</jvmTarget>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <jvmTarget>${project.build.javaVersion}</jvmTarget>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/test/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${project.build.javaVersion}</source>
                    <target>${project.build.javaVersion}</target>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Make javadoc JAR -->
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                        <configuration>
                            <jdkVersion>16</jdkVersion>
                            <sourceRoots>
                                <root>
                                    <path>src/main/kotlin</path>
                                </root>
                                <root>
                                    <path>src/main/java</path>
                                </root>
                            </sourceRoots>
                            <platform>JVM</platform>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <dokkaPlugins>
                        <plugin>
                            <groupId>org.jetbrains.dokka</groupId>
                            <artifactId>kotlin-as-java-plugin</artifactId>
                            <version>1.5.0</version>
                        </plugin>
                    </dokkaPlugins>
                </configuration>
            </plugin>
            <!-- OSSRH Releasing -->
            <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>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>4.0.5</version>
                    <executions>
                        <execution>
                            <id>git-commit-id</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                            <configuration>
                                <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                                <skipPoms>false</skipPoms>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Make sources JAR -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Code Signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- Prevent gpg from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
