// NOTE: This module is intended to be a stand-alone example which does depend on nebula. defaultTasks 'clean', 'fatJar' apply plugin: 'java' repositories { mavenCentral() } configurations { compile } dependencies { compile 'com.netflix.feign:feign-core:7.1.0' compile 'com.netflix.feign:feign-gson:7.1.0' } // create a self-contained jar that is executable // the output is both a 'fat' project artifact and // a convenience file named "build/github" task fatJar(dependsOn: classes, type: Jar) { classifier 'fat' doFirst { // Delay evaluation until the compile configuration is ready from { configurations.compile.collect { zipTree(it) } } } from (sourceSets*.output.classesDir) { } // really executable jar // http://skife.org/java/unix/2011/06/20/really_executable_jars.html manifest { attributes 'Main-Class': 'feign.example.github.GitHubExample' } // for convenience, we make a file in the build dir named github with no extension doLast { def srcFile = new File("${buildDir}/libs/${archiveName}") def shortcutFile = new File("${buildDir}/github") shortcutFile.delete() shortcutFile << "#!/usr/bin/env sh\n" shortcutFile << 'exec java -jar $0 "$@"' + "\n" shortcutFile << srcFile.bytes shortcutFile.setExecutable(true, true) srcFile.delete() srcFile << shortcutFile.bytes srcFile.setExecutable(true, true) } }