Spigot Maven

May 15, 2019 at 1:06 PM
Spigot Maven
  • Spigot Maven Repository

    Information on what to add to your pom.xml for Spigot-api and Bukkit



    Maven Repository(top)

    Spigot has a maven repository if you use it to build your plugins.
    https://hub.spigotmc.org/nexus/#view-repositories;snapshots~browsestorage

    If you want to use Spigot API, in addition to Bukkit, you should use just the Spigot API. If you want to use internal, version-depended code (e.g. CraftBukkit or NMS classes) then you must run BuildTools on the same system before. BuildTools will add CraftBukkit and Spigot to your local maven repository.

    pom.xml(top)

    This is an example of what to put in your pom.xml to get the API's from the repository.
    You should only use one of them, either bukkit or spigot-api as the spigot-api dependency includes everything that the bukkit one does.
    Just add the following code in your pom file.
    Code (XML):
    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <!--Bungeecord Repo-->
        <!--Only include if using the Spigot API dependency-->
        <repository>
           <id>bungeecord-repo</id>
           <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>
    <dependencies>
        <!--Spigot API-->
        <!--You only need one of the two, don't put both. Spigot is recommended.-->
        <dependency>
               <groupId>org.spigotmc</groupId>
               <artifactId>spigot-api</artifactId>
               <version>1.14.1-R0.1-SNAPSHOT</version>
               <scope>provided</scope>
        </dependency>
        <!--Bukkit API-->
        <!--You only need one of the two, don't put both. Spigot is recommended.-->
        <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.14.1-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
        </dependency>
    </dependencies>
    The

    build.gradle(top)

    Add this to your repositories block to use the spigot-api module:
    Code (Text):
    maven {
       url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
    }
    maven {
       url "https://oss.sonatype.org/content/repositories/snapshots"
    }
     
    Or, to use the spigot module, just add your local maven repository (using mavenLocal()).

    Then, add this to your dependencies block:
    Code (Text):
    compileOnly "org.spigotmc:spigot-api:1.14.1-R0.1-SNAPSHOT"
    A full build.gradle would look like this:
    Code (Text):
    plugins {
        id 'java'
    }

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

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

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