Added a possibility to build fat-jars of stub-runner

This commit is contained in:
Marcin Grzejszczak
2016-03-28 22:28:28 +02:00
parent 3b624d1f37
commit 538b946c5a
3 changed files with 40 additions and 1 deletions

View File

@@ -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'
}
}

View File

@@ -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:

View File

@@ -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
}
}