apply plugin: 'java' repositories { mavenCentral() } dependencies { // https://mvnrepository.com/artifact/com.h2database/h2 compile group: 'com.h2database', name: 'h2', version: '1.4.192' } sourceSets { main { java { srcDir 'src' } resources { srcDir 'res' } } } task download_deps(type: Copy) { from sourceSets.main.runtimeClasspath into 'libs/' } jar { manifest { attributes ( 'Main-Class': 'Main' ) } } // make a fat JAR task dist(type: Jar) { manifest.from jar.manifest baseName = 'marking' from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } destinationDir = file('dist') with jar }