Solved SPIGOT API USING MAVEN(INTELLIJ IDEA)

Discussion in 'Spigot Plugin Development' started by retrooper, Feb 8, 2020.

  1. So I recently started using IntelliJ and making maven projects.
    Everything was going well.
    In my pom.xml file I imported spigot like this:
    Code (Text):

    <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
    <!--Spigot API-->
    <dependency>
               <groupId>org.spigotmc</groupId>
               <artifactId>spigot-api</artifactId>
               <version>1.8.8-R0.1-SNAPSHOT</version>
               <scope>provided</scope>
    </dependency>
    <!--Bukkit API-->
    <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
    </dependency>
     
    As shown on the spigotmc forum: https://www.spigotmc.org/wiki/bbcode.2456/archive
    The problem is using this method, I only get the spigot-api.
    If I import the spigot jar as a project dependancy, I get the imports like:
    io.netty and com.mojang.authlib
    The problem with adding the spigot jar as a project dependancy, is that the file size increases massively.
    I only had this problem with IntelliJ.
    My file size becomes exactly as big or even bigger than the spigot jar itself.
    It also brings down my server performance, compared to before.
    How do I get access to these, and also with maven?
     
  2. FrostedSnowman

    Resource Staff

    You need to run BuildTools at least once to have the spigot dependency available. Depending on which version you're targeting, that's the version you'll need to specify when running BuildTools.
     
  3. You need to have run BuildTools for that version at least once. BuildTools will install a local copy of the full server source in your M2 home. Once you've done that, you can access the spigot artifact.
    That's because you're shading the entire Spigot project into your plugin.
     
  4. Ok thank you, I'll try it out.
     
  5. Now you should be able to depend on it just fine. The only difference is that the artifactId of the dependency is spigot instead of spigot-api. Same imports and some more, like netty and the authlib.
     
    • Agree Agree x 1
  6. I figured out already, but thank you so much.
    I cannot thank you enough, I always stayed away from IntelliJ for this bug I thought it was normal and I don't even know what I was thinking lol.