Search code examples
minecraftspigotnms

Im getting an error when trying to use NMS on spigot


Im getting this error when trying to use nms on spigot 1.20.4 For this one I tried in artifactID removing -api like a saw in a tutorial.

Here is part of my pom.xml file:

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot</artifactId>
        <version>1.20.4-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Error:

Unresolved dependency: 'org.spigotmc:spigot:jar:1.20.4-R01-SNAPSHOT'

Could not find artifact org.spigotmc:spigot:jar:1.20.4-R01-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

Try to run Maven import with -U flag (force update snapshots)

I also tried using spigot-server

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-server</artifactId>
        <version>1.20.4-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

With this error

[WARNING] The POM for org.spigotmc:spigot-server:jar:1.20.4-R0.1-SNAPSHOT is missing, no dependency information available
Cannot resolve org.spigotmc:spigot-server:1.20.4-R0.1-SNAPSHOT

Could not find artifact org.spigotmc:spigot-server:pom:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Could not find artifact org.spigotmc:spigot-server:pom:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

Could not find artifact org.spigotmc:spigot-server:jar:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

Try to run Maven import with -U flag (force update snapshots)

Solution

  • The right one is with spigot, like this:

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
    </dependencies>
    

    But, to make it possible to find, you have to you BuildTools by using this command:

    java -jar BuildTools.jar --rev 1.20.4 --remapped
    

    (You will need Java 17 or more)

    Then, after the build end, the spigot version will be available on local repository (at %HOMEDIR%/.m2/repository/org/spigotmc/spigot/1.20.4.). Now you can refresh the project.

    More informations here.