buildscript { repositories { mavenCentral() gradlePluginPortal() } dependencies { classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2" } } apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' repositories { mavenCentral() } jar { manifest { attributes "Main-Class": "com.baeldung.fatjar.Application" } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } } task customFatJar(type: Jar) { manifest { attributes 'Main-Class': 'com.baeldung.fatjar.Application' } baseName = 'all-in-one-jar' duplicatesStrategy = DuplicatesStrategy.EXCLUDE from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } with jar } dependencies{ implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' }