diff --git a/build.gradle b/build.gradle index 313e58fb19..ba9586b76a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,13 @@ buildscript { repositories { mavenCentral() mavenLocal() + if (project.hasProperty('fatJar')) jcenter() } dependencies { classpath "pl.allegro.tech.build:axion-release-plugin:1.3.4" classpath "com.bmuschko:gradle-nexus-plugin:2.3" classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3" + if (project.hasProperty('fatJar')) classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } diff --git a/stub-runner/stub-runner/README.md b/stub-runner/stub-runner/README.md index bd148045da..2a749ebb39 100644 --- a/stub-runner/stub-runner/README.md +++ b/stub-runner/stub-runner/README.md @@ -11,7 +11,6 @@ Runs stubs for service collaborators. Treating stubs as contracts of services al You can set the following options to the main class: ``` -java -jar stub-runner.jar [options...] -maxp (--maxPort) N : Maximum port value to be assigned to the Wiremock instance. Defaults to 15000 (default: 15000) @@ -33,6 +32,21 @@ java -jar stub-runner.jar [options...] ``` + +#### Building a Fat Jar + +Just call the following command: + +``` +./gradlew stub-runner-root:stub-runner:shadowJar -PfatJar +``` + +and inside the `build/lib` there will be a Fat Jar with classifier `fatJar` waiting for you to execute. E.g. + +``` +java -jar stub-runner/stub-runner/build/libs/stub-runner-1.0.1-SNAPSHOT-fatJar.jar -sr http://a.b.com -s a:b:c,d:e,f:g:h +``` + ### Stub runner configuration You can configure the stub runner by either passing the full arguments list with the `-Pargs` like this: diff --git a/stub-runner/stub-runner/build.gradle b/stub-runner/stub-runner/build.gradle index 63c8faa6ff..3fa0ed3b75 100644 --- a/stub-runner/stub-runner/build.gradle +++ b/stub-runner/stub-runner/build.gradle @@ -11,6 +11,8 @@ dependencies { compile 'args4j:args4j:2.32' compile 'com.nurkiewicz.asyncretry:asyncretry-jdk7:0.0.6' + if (rootProject.hasProperty("fatJar")) runtime 'ch.qos.logback:logback-classic:1.1.3' + testCompile('org.spockframework:spock-core:1.0-groovy-2.3') { exclude(group: 'org.codehaus.groovy') } @@ -71,3 +73,24 @@ Object appendToListIfNotNull(String argument, String prefix, List list) { } } } + +if (rootProject.hasProperty("fatJar")) { + + apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'maven-publish' + + publishing { + publications { + shadow(MavenPublication) { + from components.java + artifact shadowJar + } + } + } + + shadowJar { + classifier = 'fatJar' + dependsOn build + } + +} \ No newline at end of file