-
-
Notifications
You must be signed in to change notification settings - Fork 141
Maven Setup
Nicholas edited this page Jul 31, 2017
·
33 revisions
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/nexus/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-core</artifactId>
<version>[ACF VERSION]</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<version>3.1</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>2.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>
</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.
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>