Skip to content
Daniel Ennis edited this page Mar 9, 2018 · 23 revisions

Gradle

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

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath "com.github.jengelman.gradle.plugins:shadow:2.0.1"
    }
}

apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'java'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
    maven { url = "https://repo.aikar.co/content/groups/aikar/" }
    maven { url = "https://hub.spigotmc.org/nexus/content/groups/public/" }
}

compileJava {
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = 'javac'
}

dependencies {
    compile "co.aikar:acf-core:[ACF VERSION]"
}

shadowJar {
   relocate 'co.aikar.commands', '[YOUR PLUGIN PACKAGE].acf'
}

build.dependsOn shadowJar

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.