<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>areashop</artifactId>
    <packaging>jar</packaging>
    <name>AreaShop</name>
    <version>2.6.0</version> <!-- Main plugin version -->

    <parent>
        <groupId>me.wiefferink</groupId>
        <artifactId>areashop-parent</artifactId>
        <version>parent</version>
    </parent>

    <dependencies>
        <!-- Bukkit, AreaShop aims to support 1.7.9+ -->
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>craftbukkit</artifactId>
            <scope>system</scope>
            <version>any</version>
            <systemPath>${project.basedir}/../dependencies/craftbukkit-1.7.9-R0.2-SNAPSHOT.jar</systemPath>
            <type>jar</type>
            <optional>true</optional>
        </dependency>

        <!-- InteractiveMessenger library -->
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>interactivemessenger</artifactId>
            <version>1.1-SNAPSHOT</version>
        </dependency>

        <!-- BukkitDo library -->
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>bukkitdo</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>

        <!-- WorldEdit/WorldGuard -->
        <dependency>
            <groupId>com.sk89q</groupId>
            <artifactId>worldedit</artifactId>
            <scope>system</scope>
            <version>any</version>
            <systemPath>${project.basedir}/../dependencies/worldedit-bukkit-7.0.0-beta-04.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.sk89q</groupId>
            <artifactId>worldguard</artifactId>
            <scope>system</scope>
            <version>any</version>
            <systemPath>${project.basedir}/../dependencies/worldguard-legacy-7.0.0-beta-02.jar</systemPath>
        </dependency>

        <!-- Interfaces that specific WorldGuard and WorldEdit versions are built against -->
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-interface</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <!-- WorldGuard implementations -->
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldguard-5</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldguard-6</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldguard-6_1_3</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldguard-7_beta_1</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldguard-7_beta_2</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <!-- WorldEdit implementations -->
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldedit-5</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldedit-6</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldedit-7_beta_1</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-worldedit-7_beta_4</artifactId>
            <version>latest</version>
        </dependency>
        <dependency>
            <groupId>me.wiefferink</groupId>
            <artifactId>areashop-fastasyncworldedit</artifactId>
            <version>latest</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <!-- Vault -->
        <dependency>
            <groupId>net.milkbowl.vault</groupId>
            <artifactId>VaultAPI</artifactId>
            <scope>system</scope>
            <version>any</version>
            <systemPath>${project.basedir}/../dependencies/VaultAPI-1.4.jar</systemPath>
        </dependency>

        <!-- bStats -->
        <dependency>
            <groupId>org.bstats</groupId>
            <artifactId>bstats-bukkit</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Copy the jar file to a test server, activate by using -DcopyResult="/path/to/test/server" -->
        <profile>
            <id>test-locally</id>
            <activation>
                <property>
                    <name>copyResult</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.8</version>
                        <configuration>
                            <target>
                                <copy file="./target/${project.build.finalName}.jar"
                                      tofile="${copyResult}\${project.build.finalName}.jar"/>
                            </target>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Package the source files in a jar, activate by using -Dsources -->
        <profile>
            <id>package-sources</id>
            <activation>
                <property>
                    <name>sources</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Produce javadoc files, activate by using -Djavadoc -->
        <profile>
            <id>generate-javadoc</id>
            <activation>
                <property>
                    <name>javadoc</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludePackageNames>me.wiefferink.areashop.lib</excludePackageNames>
                            <destDir>${javadoc}</destDir>
                            <links>
                                <link>https://hub.spigotmc.org/javadocs/bukkit/</link>
                                <link>http://docs.sk89q.com/worldedit/apidocs/</link>
                                <link>http://docs.sk89q.com/worldguard/apidocs/</link>
                            </links>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <directory>target</directory>
        <finalName>AreaShop</finalName>
        <resources>
            <resource>
                <targetPath>.</targetPath>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>plugin.yml</include>
                    <include>config.yml</include>
                    <include>hiddenConfig.yml</include>
                    <include>default.yml</include>
                    <include>README.md</include>
                    <include>lang/*.yml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <!-- Relocate messaging framework -->
                                <relocation>
                                    <pattern>me.wiefferink.interactivemessenger</pattern>
                                    <shadedPattern>me.wiefferink.areashop.shaded.interactivemessenger</shadedPattern>
                                </relocation>
                                <!-- Relocate BukkitDo -->
                                <relocation>
                                    <pattern>me.wiefferink.bukkitdo</pattern>
                                    <shadedPattern>me.wiefferink.areashop.shaded.bukkitdo</shadedPattern>
                                </relocation>
                                <!-- Relocate bstats -->
                                <relocation>
                                    <pattern>org.bstats</pattern>
                                    <shadedPattern>me.wiefferink.areashop.shaded.bstats</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
            </plugin>
        </plugins>
    </build>
</project>
