Posted December 12, 201410 yr For some reason, my dependency doesn't seem to be working. I used the XStream library (version 1.4.7) in my mod. So, in my build.grade I included the following: compile 'org.jsoup:jsoup:1.7.2' compile 'com.thoughtworks.xstream:xstream:1.4.7' As you can see, I also have a jsoup dependency, which is working fine and dandy. You can view the XStream maven info here. When I run gradlew build, there is no error thrown (in fact, I could see it downloading everything). But, when I give someone else the file, they receive this error upon running: cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:867) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver at us.mcpvpmod.Main.preInit(Main.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) ... 10 more Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 38 more Caused by: java.lang.NullPointerException at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ... 40 more Any ideas how I could fix this?
December 12, 201410 yr Author You need to either get everyone to install the dependency manually (put it in the mods folder) or package it with your mod using something like the Gradle Shadow Plugin. Why doesn't it work like jsoup does?
December 12, 201410 yr Author JSoup will not work either. Gradle does not package dependencies with your mod. But nobody has had problems with JSoup. Could it be because JSoup has no other dependencies but XStream does?
December 12, 201410 yr Author It just crashes with XStream because you use that first in your mod .... No, JSoup works fine, please trust me. I have used it for some time, and created versions of my mod where JSoup was used successfully.
December 13, 201410 yr Author That is impossible unless your users install it separately or it is on the classpath for some other reason. Pleas trust me: Gradle does not package libraries automatically. Ugh, I'll take your word for it, though I can't imagine people have JSoup installed... Why does gradlew build not throw any errors? Because I have the requirements on my system? Also, you mentioned something in another topic about all jars in /build/libs being marked as dependencies. Can that help me?
December 13, 201410 yr Author No. This is on the build side. All dependencies are resolved in your development environment. But when users install your mod there is no gradle or anything like that to do that. So you have to either ship the dependencies yourself or get users to install them. Right. So you suggest using the Gradle Shadow Plugin to ship the dependency?
December 14, 201410 yr Author Yes. Could you give a quick how-to? I'm checking out the GitHub page, but not sure what is required for my needs.
December 14, 201410 yr Author I can't, I have never used it. Okay, thanks for all your help anyway. Also, perhaps this thread should be moved to the ForgeGradle sub-category?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.