Budowanie uberjara za pomocą Gradle

Jestem nowicjuszem Gradle. Chcę zbudować uberjar (AKA fatjar), który zawiera wszystkie zależności przechodnie projektu. Jakie linie muszę dodać do mojego „build.gradle”?

Oto, co aktualnie mam: (skopiowałem to gdzieś kilka dni temu, ale nie pamiętam skąd.)

task uberjar(type: Jar) {
    from files(sourceSets.main.output.classesDir)

    manifest {
        attributes 'Implementation-Title': 'Foobar',
                'Implementation-Version': version,
                'Built-By': System.getProperty('user.name'),
                'Built-Date': new Date(),
                'Built-JDK': System.getProperty('java.version'),
                'Main-Class': mainClassName
    }
}

questionAnswers(4)

yourAnswerToTheQuestion