What you are looking for is the application plugin which allows you build a standalone JVM application including all dependencies and run scripts.
apply plugin:'application'
mainClassName="test.tree.App"
EDIT:
This should create the uberjar you want:
task uberjar(type: Jar) {
from files(sourceSets.main.output.classesDir)
from configurations.runtime.asFileTree.files.collect { zipTree(it) }
manifest {
attributes 'Main-Class': 'test.tree.App'
}
}