<?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>

    <artifactId>FastNbt</artifactId>
    <groupId>beer.devs</groupId>
    <version>1.4.0</version>

    <name>FastNbt</name>
    <packaging>pom</packaging>
    <description>Spigot library to edit items NBT very fast</description>
    <url>https://github.com/LoneDev6/FastNBT</url>

    <developers>
        <developer>
            <name>LoneDev</name>
            <email>info@matteodev.it</email>
            <url>https://github.com/LoneDev6/</url>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/LoneDev6/FastNBT.git</connection>
        <developerConnection>scm:git:https://github.com/LoneDev6/FastNBT.git</developerConnection>
        <url>https://github.com/LoneDev6/FastNBT</url>
    </scm>

    <properties>
        <java.version>9</java.version>
        <maven.compiler.source>9</maven.compiler.source>
        <maven.compiler.target>9</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <paper-nms-maven-plugin-version>1.4.4</paper-nms-maven-plugin-version>
        <jars_libs_folder>C:/Progetti/Minecraft/Spigot/_jars</jars_libs_folder>
        <targets_prefix_folder>R:\maven-target</targets_prefix_folder>
    </properties>

    <modules>
        <module>FastNbt-core</module>
        <module>FastNbt-jar</module>
        <module>fastnbt_nms_v1_17_R1</module>
        <module>fastnbt_nms_v1_18_R2</module>
        <module>fastnbt_nms_v1_19_R1</module>
        <module>fastnbt_nms_v1_19_R2</module>
        <module>fastnbt_nms_v1_19_R3</module>
        <module>fastnbt_nms_v1_20_R1</module>
        <module>fastnbt_nms_v1_20_R2</module>
        <module>fastnbt_nms_v1_20_R3</module>
        <module>fastnbt_nms_v1_20_4</module>
        <module>fastnbt_nms_v1_20_6</module>
        <module>fastnbt_nms_v1_21</module>
        <module>fastnbt_nms_v1_21_1</module>
        <module>fastnbt_nms_v1_21_3</module>
        <module>fastnbt_nms_v1_21_4</module>
    </modules>

    <pluginRepositories>
        <pluginRepository>
            <id>bytecode.space</id>
            <url>https://repo.bytecode.space/repository/maven-public/</url>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <repository>
            <id>ftp-matteodev</id>
            <url>ftp://ftp.matteodev.it/htdocs/spigot/public/maven/</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>maven.apache.org</id>
            <url>https://repo.maven.apache.org/maven2/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>

    <build>
        <directory>${project.basedir}/../.cache/targets/${project.artifactId}/target/</directory>
        <!-- Disable useless maven plugins -->
        <!-- https://developer.jboss.org/people/ozizka/blog/2013/07/06/how-to-speed-up-maven-builds-disabling-unused-plugins -->
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.12.4</version>
                    <configuration>
                        <skipTests>true</skipTests>
                        <skip>true</skip>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <!-- Disable useless maven plugins -->
        <!-- https://developer.jboss.org/people/ozizka/blog/2013/07/06/how-to-speed-up-maven-builds-disabling-unused-plugins -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
                <executions> <execution> <id>default-clean</id> <phase>none</phase> </execution> </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M4</version>
                <executions> <execution> <id>default-test</id> <phase>none</phase> </execution> </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution> <id>default-testResources</id> <phase>none</phase> </execution>
                </executions>
            </plugin>

            <!-- Maven central requires javadocs -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</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>2.9.1</version>
                <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.5</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Maven central requires md5 of files -->
            <plugin>
                <groupId>net.ju-n.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>artifacts</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Publishing to Maven central -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.7.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <excludeArtifacts>
                        <excludeArtifact>FastNbt-jar</excludeArtifact>
                    </excludeArtifacts>
                </configuration>
            </plugin>

            <!-- Shading -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <excludes>
                                    <exclude>junit:junit</exclude>
                                    <exclude>*:xml-apis</exclude>
                                    <exclude>org.apache.maven:lib:tests</exclude>
                                    <exclude>log4j:log4j:jar:</exclude>
                                    <exclude>com.google.gson:*</exclude>
                                    <exclude>com.google.common:*</exclude>
                                    <exclude>com.google.thirdparty:*</exclude>
                                    <exclude>com.google.guava:*</exclude>
                                    <exclude>org.javassist:*</exclude>
                                </excludes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>org.intellij.</pattern>
                                    <shadedPattern>beer.devs.fastnbt_benchmark.libs.org.intellij.</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.jetbrains.</pattern>
                                    <shadedPattern>beer.devs.fastnbt_benchmark.libs.org.jetbrains.</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
<!--            TODO: recode this js code shit, it's not compatible with 1.20.3+ code and I'm lazy to fix it. -->
<!--            <plugin>-->
<!--                <groupId>org.codehaus.mojo</groupId>-->
<!--                <artifactId>exec-maven-plugin</artifactId>-->
<!--                <version>3.1.0</version>-->
<!--                <inherited>false</inherited>-->
<!--                <executions>-->
<!--                    &lt;!&ndash;-->
<!--                    Spigot to Mojang mapping is different on each version,-->
<!--                    so I use this trick to generate the files on demand.-->
<!--                    &ndash;&gt;-->
<!--                    <execution>-->
<!--                        <id>GenerateNms</id>-->
<!--                        <phase>generate-sources</phase>-->
<!--                        <configuration>-->
<!--                            <executable>cmd</executable>-->
<!--                            <workingDirectory>${project.basedir}</workingDirectory>-->
<!--                            <workingDirectory>${project.basedir}</workingDirectory>-->
<!--                            <arguments>-->
<!--                                <argument>/C</argument>-->
<!--                                <argument>"node .mvn-exec/GenerateNms.js"</argument>-->
<!--                            </arguments>-->
<!--                        </configuration>-->
<!--                        <goals>-->
<!--                            <goal>exec</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
            <!-- Attach Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <configuration>
                    <doclint>none</doclint>
               </configuration>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>3.5.2</version>
            </extension>
        </extensions>
    </build>
</project>
