1 2 3 4 5 6 7 8 9 10 11 12 13 |
// create a single Jar with all dependencies // (avoids "no main manifest attribute, in HelloWorld-1.0.jar") task fatJar(type: Jar) { manifest { attributes 'Implementation-Title': 'Hello World', 'Implementation-Version': version, 'Main-Class': 'net.crusy.java.HelloWorld' } baseName = project.name + '-all' from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' with jar } |
Quelle, ergänzt um, Aufruf dann via
1 2 3 |
$ gradle clean $ gradle fatJar $ java -jar .\build\libs\HelloWorld-all-1.0.jar |