WesJD / AnvilGUI

Capture user input in Minecraft through an anvil GUI in under 20 lines of code
MIT License
481 stars 114 forks source link

NoClassDefFoundError - How to use the API in my Codespace? #349

Closed pongy20 closed 2 months ago

pongy20 commented 2 months ago

Hey all,

i've added the api as a maven dependency to my pom and also the plugin part. As version i choosed 3.5.0 and as shadedPattern i took my namespace + anvolgui. After exporting my plugin this expeption showed up: Caused by: java.lang.NoClassDefFoundError: net/wesjd/anvilgui/AnvilGUI$Builder at EasyKit.jar/de.pongy.easykits.kit.KitService.onCreateKit(KitService.java:37) ~[EasyKit.jar:?] at EasyKit.jar/de.pongy.easykits.command.KitCommand.onCommand(KitCommand.java:36) ~[EasyKit.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?] ... 27 more

After putting my own plugin into a decompiler i was seeing the anvilgui code in the package I set in the pom. Do you guys know what could be the issue?

plugin part of my pom:

org.apache.maven.plugins maven-shade-plugin 3.5.0 package shade net.wesjd.anvilgui de.pongy.easykits.anvilgui *:* false net/wesjd/anvilgui/**
0dinD commented 2 months ago

Hi! As you can see, the example you shared from your pom.xml file is unreadable. This is because it contains special characters which won't display properly unless you use a "code block". You can read more about this here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

It would also be helpful if you could use a code block for the stack trace you shared so that it stands out more from the regular text.


Either way, I don't immediately know what's wrong based on the information you gave, so if you could give a longer (complete) stack trace and/or a longer (complete) pom.xml file, that would be helpful. If you can provide a link to your project as a GitHub repository, that would be even better (if it's something you are OK with sharing to the public).

I would also just open the JAR file as a ZIP archive and check what the path of AnvilGUI$Builder.class is inside the JAR file.

pongy20 commented 2 months ago

Hey, thanks for the reply. I found another solution for this project. Maybe you comment will help another people discovering the same issue.