Spigot Gradle - Historical

Applied By Proximyst: Mar 13, 2020 at 4:35 PM

Spigot Gradle

Spigot Maven Repository for Gradle

Information on what to add to your build.gradle for the Spigot-API and Bukkit

Maven Repository(top)

Spigot has a maven repository if you use it to build your plugins.


This is an example of what to put in your build.gradle to get the API's from the repository.
You should only use one of them.
If you want to use Spigot API's, in addition to Bukkit, you should replace it with just the Spigot API. If you want to use NMS, you must add the "spigot" dependency, or the "craftbukkit" dependency. The "spigot" dependency contains the Bukkit API, the Spigot API, NMS, and the Spigot patches for NMS. Take note that to use NMS you need to have run BuildTools for the appropriate version locally, in such a way it is found located under ~/.m2.
Just add the following code in your build file.
Code (Groovy):
repositories {
  maven {
    url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'

    // As of Gradle 5.1, you can limit this to only those
    // dependencies you expect from it
    content {
      includeGroup 'org.bukkit'
      includeGroup 'org.spigotmc'
   As Spigot-API depends on the Bungeecord ChatComponent-API,
  we need to add the Sonatype OSS repository, as Gradle,
  in comparison to maven, doesn't want to understand the ~/.m2
  directory unless added using mavenLocal(). Maven usually just gets
  it from there, as most people have run the BuildTools at least once.
  This is therefore not needed if you're using the full Spigot/CraftBukkit,
  or if you're using the Bukkit API.

  maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
  // mavenLocal() // This is needed for CraftBukkit and Spigot.

dependencies {
  // Pick only one of these and read the comment in the repositories block.
  compileOnly 'org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT' // The Spigot API with no shadowing. Requires the OSS repo.
  compileOnly 'org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT' // The Bukkit API with no shadowing.
  compileOnly 'org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
  compileOnly 'org.bukkit:craftbukkit:1.14.4-R0.1-SNAPSHOT' // The full CraftBukkit server with no shadowing. Requires mavenLocal.


The following Gradle plugins may generate the plugin.yml for you:

- Spigradle - Automatic detection of main class and plugin.yml generation.
- Minecrell/plugin-yml - An elaborate DSL for generating the YAML mapping of both plugin.yml for Bukkit/Nukkit as well as BungeeCord.