﻿<?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>com.github.cryptomorin</groupId>
    <artifactId>XSeries</artifactId>
    <version>8.6.2</version>

    <name>XSeries</name>
    <description>A set of utilities for Minecraft plugins</description>
    <url>https://www.spigotmc.org/threads/378136/</url>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/CryptoMorin/XSeries/issues</url>
    </issueManagement>

    <inceptionYear>2019</inceptionYear>

    <developers>
        <developer>
            <id>CryptoMorin</id>
            <name>Crypto Morin</name>
            <roles>
                <role>Owner</role>
            </roles>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>nms-repo</id>
            <url>https://repo.codemc.org/repository/nms/</url>
        </repository>
    </repositories>

    <properties>
        <!-- Latest version -->
        <spigotVersion>1.18.1-R0.1-SNAPSHOT</spigotVersion>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>${spigotVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <!--all,-missing-->
                    <doclint>none</doclint>
                    <release>8</release>
                    <excludePackageNames>com.cryptomorin.xseries.unused:com.cryptomorin.xseries.particles</excludePackageNames>
                    <!-- Apparently this is needed because it's a bug with maven JavaDoc plugin not being able to find the exe by itself. -->
                    <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <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>
                    </execution>
                </executions>
            </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://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <proc>none</proc>
                    <source>8</source>
                    <target>8</target>
                    <compilerArgs>
                        <!-- Fails to build the JAR if one of the excluded classes are being used inside an included class. -->
                        <arg>-sourcepath</arg>
                        <arg>doesnotexist</arg>
                    </compilerArgs>
                    <excludes>
                        <exclude>com/cryptomorin/xseries/unused/</exclude>
                        <exclude>com/cryptomorin/xseries/SkullCacheListener.java</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <!--<failIfNoTests>true</failIfNoTests>-->
                    <trimStackTrace>false</trimStackTrace>
                    <workingDirectory>${basedir}/target/tests</workingDirectory>
<!--                    <dependenciesToScan>-->
<!--                        <dependency>*:spigot:*:*:1.16.5-R0.1-SNAPSHOT</dependency>-->
<!--                    </dependenciesToScan>-->
                    <includes>
                        <include>**/DummySpigot.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>

        <testSourceDirectory>src/test</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
    </build>

    <profiles>
        <profile>
            <id>tester</id>
            <dependencies>
                <dependency>
                    <groupId>org.spigotmc</groupId>
                    <artifactId>spigot</artifactId>
                    <version>${spigotVersion}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.8.1</version>
                        <configuration>
                            <source>17</source>
                            <target>17</target>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default-testCompile</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>
                                    <skip>false</skip>
                                    <testIncludes>
                                        <include>*/**DummySpigot.java</include>
                                    </testIncludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>18</id>
            <properties>
                <nms>18_R1</nms>
                <spigotVersion>1.18.1-R0.1-SNAPSHOT</spigotVersion>
            </properties>
        </profile>
        <profile>
            <id>17</id>
            <properties>
                <nms>17_R1</nms>
                <spigotVersion>1.17.1-R0.1-SNAPSHOT</spigotVersion>
            </properties>
        </profile>
        <profile>
            <!-- Doens't seem to work. I can't find a way to compile with one dependency and test with another -->
            <id>16</id>
            <properties>
                <nms>16_R3</nms>
                <spigotVersion>1.16.5-R0.1-SNAPSHOT</spigotVersion>
            </properties>
        </profile>
    </profiles>
</project>
