-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
128 lines (107 loc) · 2.87 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
buildscript {
ext {
springBootVersion = '1.3.3.RELEASE'
assertjVersion = '3.3.0'
}
repositories {
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
jcenter()
}
dependencies {
classpath 'net.researchgate:gradle-release:2.3.4'
classpath 'org.ajoberstar:gradle-git:1.4.2'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"
classpath 'se.transmode.gradle:gradle-docker:1.2'
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
}
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'docker'
apply plugin: 'application'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'ls-shipfast'
jar {
version = '0.0.1'
}
// Running locally
bootRun {
jvmArgs = ["-Dserver.port=10000"]
}
distDocker {
exposePort 80
}
docker {
baseImage = 'anapsix/alpine-java:8'
}
bootRepackage {
classifier = 'exec'
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/intTest/java')
}
resources.srcDir file('src/intTest/resources')
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile "org.springframework.boot:spring-boot-starter-jetty"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-devtools"
compile "org.springframework.boot:spring-boot-starter-amqp"
testCompile "junit:junit"
testCompile "org.assertj:assertj-core:$assertjVersion"
testCompile "org.springframework.boot:spring-boot-starter-test"
}
tasks.withType(JavaCompile) {
options.incremental = true
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}
task startIntegrationServices(type: Exec, group: 'docker') {
// Define integration services
commandLine 'docker', 'run', '-p', '27017', '--name', 'db', '-d', 'mongo'
}
task stopIntegrationServices(group: 'docker') << {
// Clean-up integration services
exec { commandLine 'docker', 'stop', 'db' }
exec {
ignoreExitValue true
commandLine 'docker', 'rm', 'db'
}
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
integrationTest.dependsOn startIntegrationServices
integrationTest.finalizedBy stopIntegrationServices
task createWrapper(type: Wrapper) {
gradleVersion = '2.9'
}