How to account for dependencies in the Assembly jar file?

There are some project on Java with that build.gradle:
plugins {
 id 'java'
 id 'application'
 id 'com.github.johnrengelman.shadow' version '2.0.1'
}
mainClassName = "Main"
group 'org.q'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
jcenter()
}

dependencies {
 testCompile group: 'junit', name: 'junit', version: '4.12'
 compile group: 'net.dv8tion', name: 'JDA', version: '4.1.1_121'
 compile group: 'org.mongodb', name: 'mongodb-driver-sync', version: '3.12.2'
 compile group: 'org.atteo.classindex', name: 'classindex', version: '3.4'
 annotationProcessor group: 'org.atteo.classindex', name: 'classindex', version: '3.4'
}

jar {
 manifest {
 attributes 'Main-Class': 'discordbot.Main'
}
}

compileJava.options.encoding = 'UTF-8'


When you try to build the project into jar by calling the "gradle jar" the file successfully created but when I attempt to execute it(java-jar "path/file.jar") gets the following:
Exception in thread "main" java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder
 at discordbot.Main.main(Main.java:17)
Caused by: java.lang.ClassNotFoundException: net.dv8tion.jda.api.JDABuilder
 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
 at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
 1 ... more

It is logical to assume that the file is going without the dependency, hence the question: how to configure gradle so it was either stick all the dependent libs in the jar, or put them together in the form of jar'nicks and prescribed the classpath?
April 19th 20 at 12:37
1 answer
April 19th 20 at 12:39
It seems that something is missing.
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'


https://imperceptiblethoughts.com/shadow/getting-s...

Find more questions by tags GradleJava