Solved Eclipse ANT Builder help

Discussion in 'Spigot Plugin Development' started by Justin393, May 20, 2020.

  1. I'm having issues with using the ANT builder in Eclipse.

    In my pom.xml I am shading in an external plugin, but when Eclipse builds the plugin to run the test server inside of Eclipse it is not shading in the plugin, so I am getting a NoClassDefFound

    Here is the error:
    java.lang.NoClassDefFoundError: de/leonhard/storage/Yaml
    at justindevb.rustmc.Utils.FileUtil.createYaml( ~[?:?]
    at justindevb.rustmc.Utils.Settings.<init>( ~[?:?]
    at justindevb.rustmc.Core.initObjects( ~[?:?]
    at justindevb.rustmc.Core.onEnable( ~[?:?]
    at ~[spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin( [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin( [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins( [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at net.minecraft.server.v1_15_R1.MinecraftServer.a( [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at net.minecraft.server.v1_15_R1.DedicatedServer.init( [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at [spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at [?:1.8.0_212]
    Caused by: java.lang.ClassNotFoundException:
    at ~[?:1.8.0_212]
    at ~[spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at ~[spigot-1.15.2.jar:git-Spigot-2f5d615-d07a78b]
    at java.lang.ClassLoader.loadClass( ~[?:1.8.0_212]
    at java.lang.ClassLoader.loadClass( ~[?:1.8.0_212]
    ... 13 more

    Code (Java):
    Yaml yaml = new Yaml(name, core.getDataFolder().toString());
    My Builder.xml:

    Code (Text):
    <?xml version="1.0" ?>
    <!-- Configuration of the Ant build system to generate a Jar file -->
    <project name="RustMC" default="CreateJar">
      <target name="CreateJar" description="Create Jar file">
            <jar jarfile="./server/plugins/Plugin.jar" basedir="./target/classes/" includes="**/*" />
    Running the server locally in Eclipse works, I was doing it to test changes, it only recently broke once I needed to shade in the external library. If I decompile the plugin after Eclipse builds it, the library is not shaded in.
  2. Forgot to post my pom.xml :
    Code (Text):
    <project xmlns=""





            <defaultGoal>clean package install</defaultGoal>
    If no one has ideas on how to make it work, I might just end up removing it as a dependency and manually putting the classes into my project
    #2 Justin393, May 21, 2020
    Last edited: Aug 31, 2020
  3. Are you building using maven?
  4. I’m running the server inside of Eclispe, so I hit the run button. Up until I started using the shaded library it would work, but now it throws a NoClassDefFound and when I decompile the built plugin it’s not shaded.

    when I build it outside of eclipse with maven using “mvn clean install” it only packages the resources. I’ve been busy and haven’t had a chance to debug that yet.
  5. Finally had time to work on it again, I can now build it with “mvn clean install” on the command line and it works perfectly on a local server outside of eclipse. When I try launching it in eclipse I still get the NoClassDefFound, so it’s still not shading. And I have no idea how to get eclispe to shade a library in when running a builder
  6. Got it to work. Have to run a Maven build configuration within eclipse in order to do the shading. Changed the outputFile of the maven-shade-plugin configuration so the shaded jar is output into the eclipse server folder. After maven builds I just run the server like normal.