apply plugin: 'java' repositories { mavenLocal() mavenCentral() } def javaWebsocketVersion = "1.3.0" dependencies { compile 'org.java-websocket:Java-WebSocket:' + javaWebsocketVersion } task download_jars(type: Copy) { from sourceSets.main.runtimeClasspath into 'libs/java_websocket/' } jar { manifest { attributes ( 'Main-Class': 'websocket.tester.WebSocketTesterFrame' ) } } task dist(type: Jar) { manifest.from jar.manifest baseName = 'WebSocket-Client' from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } destinationDir = file('dist') with jar }