Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] Gradle Dependency troubles


NomNuggetNom
 Share

Recommended Posts

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? :(

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.