Spigot Gradle - Historical

Applied By Adelemphii: Apr 20, 2021 at 5:44 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 {
  mavenCentral() // This is needed for dependencies.
   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' }
  maven { url = 'https://hub.spigotmc.org/nexus/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.12.2-R0.1-SNAPSHOT' // The Spigot API with no shadowing. Requires the OSS repo.
  compileOnly 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT' // The Bukkit API with no shadowing.
  compileOnly 'org.spigotmc:spigot:1.12.2.-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
  compileOnly 'org.bukkit:craftbukkit:1.12.2-R0.1-SNAPSHOT' // The full CraftBukkit server with no shadowing. Requires mavenLocal.