Solved Can't compile jar

Discussion in 'Spigot Plugin Development' started by apatuka, Mar 13, 2020.

  1. I want to compile a plugin, but throws me a lot of errors, this is the most common line:

    package net.minecraft.server.v1_15_R1 does not exist

    I followed these links:
    https://www.spigotmc.org/wiki/bbcode.8842/archive
    https://www.spigotmc.org/threads/nms-maven-dependency.232867/

    So i used java -jar BuildTools.jar --rev 1.52.1 to get a copy to my local repo
    And also i changed on pom.xml instead of <artifactId>spigot</artifactId> i changed to
    <artifactId>spigot-api</artifactId>

    Code (Text):
        <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.15.1-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
        </dependency>
    I don't know what exactly to do.

    Thank you !
     
  2. Choco

    Moderator

    If you want to use server internals, you cannot rely on the API. It has no internals. You should be depending on spigot instead of spigot-api. Do note that you'll have to have run BuildTools in order for it to be installed in your local Maven repository. Though you should have run it anyways to get the server in the first place.

    EDIT: Seems you've already run it. Missed that part in the OP. Then yes, the spigot dependency should work fine.
     
    • Agree Agree x 1
  3. spigot-api is the artifact for Spigot's API, an enhanced version of Bukkit. To use NMS, you need to use the artifact spigot, the actual server implementation.
     
    • Agree Agree x 1
  4. Changed from spigot-api to spigot and now works ! Thank you !