missingfaktor missingfaktor - 1 year ago 146
Groovy Question

Building a uberjar with Gradle

I am a Gradle novice. I want to build a uberjar (AKA fatjar) that includes all the transitive dependencies of the project. What lines do I need to add to my "build.gradle"?

This is what I currently have: (I copied it from somewhere a few days back, but don't recollect from where.)

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

Answer Source

Have you tried the fatjar example in the gradle cookbook?

What you're looking for is the shadow plugin for gradle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download