Add the following to your build.gradle
file:
tasks.register('customFatJar', Jar) {
dependsOn 'clean'
dependsOn 'build'
tasks.named('build').get().mustRunAfter('clean')
tasks.named('customFatJar').get().mustRunAfter('build')
manifest {
attributes 'Main-Class': 'com.klassconcepts.gradleSample.Main'
}
archiveFileName = "klass-gradle-sample-exe.jar"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}