I have a project with Gradle dependencies (say projectA) that, in order to debug it, is included in the class path of another project (say rootProject). The rootProject scans the classpath and loads projectA at runtime.
When I run rootProject, it says that dependencies of projectA are not found, by throwing a java.lang.ClassNotFoundException
.
java.lang.NoClassDefFoundError: org/glassfish/jersey/server/ResourceConfig
at be.vervaeck.sam.spongerest.RESTServer.<init>(RESTServer.java:18) ~[RESTServer.class:?]
at be.vervaeck.sam.spongerest.RESTServer.<init>(RESTServer.java:27) ~[RESTServer.class:?]
at be.vervaeck.sam.spongerest.SpongePlugin.onServerStart(SpongePlugin.java:25) ~[SpongePlugin.class:?]
at org.spongepowered.common.event.listener.GameStartedServerEventListener_SpongePlugin_onServerStart2.handle(Unknown Source) ~[?:?]
at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:86) ~[RegisteredListener.class:?]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:238) [SpongeModEventManager.class:?]
at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:282) [SpongeModEventManager.class:?]
at org.spongepowered.mod.SpongeMod.onStateEvent(SpongeMod.java:184) [SpongeMod.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) [LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.onPost(LoadController.java:53) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.serverStarted(Loader.java:800) [Loader.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarted(FMLCommonHandler.java:289) [FMLCommonHandler.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:510) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.server.ResourceConfig
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_74]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_74]
... 34 more
In Eclipse, how can I make sure projectA's dependencies are included in the class path of the debug session of rootProject?
You can declare a project dependency in build.gradle. Eg: