I'm attempting to run a sponge plugin with an external dependency (JDA) and when i build a shaded jar with the dependency it still says that jackson-databind isnt found even though when i open the jar itself i can see the class it cant find.
I've tried including JDA as a local jar, i've tried including jackson itself as a dependency, I even tried taking out JDA and just including jackson and it still couldnt find it. For some reason it looks like jackson doesn't like to be included in shaded jars
plugins {
id 'org.spongepowered.plugin' version '0.9.0'
id "com.github.johnrengelman.shadow" version "5.1.0"
}
group = pluginGroup
version = pluginVersion
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
repositories {
jcenter()
}
dependencies {
compileOnly 'org.spongepowered:spongeapi:7.1.0'
annotationProcessor 'org.spongepowered:spongeapi:7.1.0'
compile 'net.dv8tion:JDA:4.0.0_52'
}
sponge.plugin.id = pluginId
I have to imagine this has something to do with it being a plugin and not a standalone jar and that somehow effects the classpath or something, at this point i'm not sure what's going on. Whenever i start the server with the shaded jar and it tries to use JDA it throws this error:
[22:08:55 ERROR] [STDERR]: Exception in thread "OkHttp Dispatcher" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.utils.data.DataObject.<clinit>(DataObject.java:54)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.requests.Response.parseBody(Response.java:204)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.requests.Response.parseBody(Response.java:182)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.requests.Response.get(Response.java:124)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.requests.Response.getObject(Response.java:105)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.utils.SessionControllerAdapter.lambda$getGateway$0(SessionControllerAdapter.java:85)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.internal.requests.RestActionImpl.handleSuccess(RestActionImpl.java:247)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:237)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:197)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.internal.requests.Requester.lambda$attemptRequest$1(Requester.java:191)
[22:08:55 ERROR] [STDERR]: at net.dv8tion.jda.internal.requests.FunctionalCallback.onResponse(FunctionalCallback.java:60)
[22:08:55 ERROR] [STDERR]: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:216)
[22:08:55 ERROR] [STDERR]: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
[22:08:55 ERROR] [STDERR]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[22:08:55 ERROR] [STDERR]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[22:08:55 ERROR] [STDERR]: at java.lang.Thread.run(Thread.java:748)
[22:08:55 ERROR] [STDERR]: Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
[22:08:55 ERROR] [STDERR]: at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101)
[22:08:55 ERROR] [STDERR]: at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[22:08:55 ERROR] [STDERR]: at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[22:08:55 ERROR] [STDERR]: ... 16 more