There are multiple posts (old and new) with instructions on how to generate a fat jar, this is, a jar file for your application
containing also your application's dependencies. Most solutions I have tried did not work for me, even in a simple Hello World
java application, but I have found one that seems to work as expected.
Here it is:
Create your Gradle java project as usual. Then:
- Adjust your 
build.gradlefile to have thejavaandapplicationplugins. - Mark your application dependencies as 
implementation(see thedependenciessection). - Be sure to have a defined 
mainClassName. - Define the 
fatJaras described below. - When running your Gradle tasks, make sure to call the 
fatJartask instead of the normaljartask. 
Here is an example build.gradle content with all the mentioned tips:
plugins {
    id 'java'
    id 'application'
}
group 'dev.test'
version '1.0.0'
repositories {
    mavenCentral()
}
dependencies {
    implementation 'your.test.dependency.libs:here:1.0.1'
    testImplementation group: 'junit', name: 'junit', version: '4.12'
}
mainClassName = 'dev.test.your.App'
task fatJar(type: Jar) {
    manifest {
        attributes 'Main-Class': "${mainClassName}"
    }
    archiveBaseName = "${rootProject.name}"
    from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}