Spigot Maven

Oct 16, 2019
Spigot Maven
  • Spigot Maven Repository

    Information on what to add to your pom.xml to access the Spigot API



    Maven Repository(top)

    SpigotMC has a Maven repository which can be used by plugin developers to add Spigot API to their build system.

    The SpigotMC Maven repository provides two artifacts relevant to Spigot plugin development, the Bukkit API and the Spigot API. Developers unsure of which artifact to include should default to using the Spigot API. Most, if not all, uses for the Bukkit API artifact are covered by the Spigot API artifact. Note that this repository does not provide the implementation artifacts. Developers wishing to use internal, version-dependent code (e.g. CraftBukkit or NMS classes) must run BuildTools to install those artifacts to their local Maven repository.

    pom.xml(top)

    In order to access the Spigot API using Maven, developers need to add both of the following to the pom.xml: 1) the Spigot Maven repository and 2) the Spigot API artifact. These additions are excerpted in the following code snippet:
    Code (XML):
    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <!--This adds the Spigot API artifact to the build -->
        <dependency>
               <groupId>org.spigotmc</groupId>
               <artifactId>spigot-api</artifactId>
               <version>1.14.4-R0.1-SNAPSHOT</version>
               <scope>provided</scope>
        </dependency>

        <!--This adds the Bukkit API artifact to the build -->
        <!-- Do not include this in the pom.xml file if the Spigot API is already added -->
        <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.14.4-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
        </dependency>
    </dependencies>

    build.gradle(top)

    Accessing the Spigot API using Gradle follows much the same process as with using Maven. Developers need to add both of the following to the build.gradle: 1) the Spigot Maven repository and 2) the Spigot API artifact.

    It is possible to add the SpigotMC Maven repository to a Gradle build with the following code snippet:
    Code (Text):
    maven {
       url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
    }
    It is also possible to to use the Spigot module by adding the local maven repository with using mavenLocal().

    The Spigot API artifact can then be added to the dependencies block with the following code snippet:
    Code (Text):
    compileOnly "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT"
    Put together, a full build.gradle might look something like the following:
    Code (Text):
    plugins {
        id 'java'
    }

    group 'your.group'
    version '1.0-SNAPSHOT'

    repositories {
        mavenCentral()
        maven {
            url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
        }
    }

    dependencies {
        compileOnly "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT"
    }
  • Loading...
  • Loading...