Build fat jar of a gradle project

Use the shadow plugin

plugins {
    id 'application'
    id 'com.github.johnrengelman.shadow' version '7.1.2'
}

Declare main class

application {
    mainClass='com.therdnotes.hello.Main'
}

Customize the jar(output) name | optional

// Output to build/libs/hello-api.jar
shadowJar {
    archiveBaseName.set('hello-api')
    archiveClassifier.set('')
    archiveVersion.set('')
}

Helpful?

If you think this is helpful 🎈
Don't keep it to yourself 🙊

Share it with your lovely followers at twitter 🗽

lets connect viatwitter