Skip to content
Daniel Ennis edited this page Jun 7, 2018 · 33 revisions

Maven

First you will need to add the repositories (you should already have Spigot) and the dependency to your pom.xml You will also need to shade the library into your plugin jar.

<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>


    <repositories>
        <repository>
            <id>aikar</id>
            <url>https://repo.aikar.co/content/groups/aikar/</url>
        </repository>
        <repository>
            <id>spigot</id>
            <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>co.aikar</groupId>
            <artifactId>acf-bukkit</artifactId> <!-- Change to other platform if not using bukkit -->
            <version>0.5.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <version>3.7.0</version>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
                    <relocations>
                        <relocation>
                            <pattern>co.aikar.commands</pattern>
                            <shadedPattern>[YOUR PLUGIN PACKAGE].acf</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Replace [ACF VERSION] with the latest version found on the ACF Repo

Replace [YOUR PLUGIN PACKAGE] with a package to your plugin so that ACF is relocated to it.

Enabling -parameters on the compiler lets ACF automatically generate Syntax messages for you using the parameter names. If you do not set this, syntax messages will use confusing names.

Kotlin

For Kotlin projects you will also need to include this to pass -parameters onto the Kotlin compiler:

<configuration>
    <jvmTarget>1.8</jvmTarget>
    <javaParameters>true</javaParameters>
</configuration>