-
-
Notifications
You must be signed in to change notification settings - Fork 148
Maven Setup
First things first, add the repository and the dependency to your pom.xml
while obviously having the platform's repositories and dependencies ready.
such as
Bukkit
/Spigot
,Paper
,Sponge
,BungeeCord
, orJDA
** WARNING: Do not skip the section below this!! **
<repositories>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-[PLATFORM]</artifactId> <!-- Don't forget to replace this -->
<version>[VERSION]</version> <!-- Replace this as well -->
<!-- Example Platform/Version
<artifactId>acf-paper</artifactId>
<version>0.5.1-SNAPSHOT</version>
-->
</dependency>
</dependencies>
Replace [PLATFORM]
and [VERSION]
with the platform you're using and the latest version of acf, that can be found here.
You will also need to shade the library into your plugin .jar
file.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<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.4.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> <!-- Replace this -->
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>[YOUR_PLUGIN_PACKAGE].locales</shadedPattern> <!-- Replace this -->
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
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 don't set this, the syntax messages will use confusing names.
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>