-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
175 lines (141 loc) · 5.42 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:2.0.8.RELEASE')
classpath('com.adarshr:gradle-test-logger-plugin:1.6.0')
classpath('gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.13.0')
classpath('org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7')
}
}
plugins {
id "org.sonarqube" version "2.7"
}
sonarqube {
properties {
property 'sonar.projectName', 'Gradle Docker - Sonar'
property "sonar.projectKey", "gradleSonar"
}
}
group = 'springio'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.adarshr.test-logger'
apply plugin: 'com.palantir.docker'
bootJar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
testlogger {
// pick a theme - mocha, standard, plain, mocha-parallel, standard-parallel or plain-parallel
theme 'standard'
// set to false to disable detailed failure logs
showExceptions true
// set threshold in milliseconds to highlight slow tests
slowThreshold 2000
// displays a breakdown of passes, failures and skips along with total duration
showSummary true
// set to false to hide passed tests
showPassed true
// set to false to hide skipped tests
showSkipped true
// set to false to hide failed tests
showFailed true
// enable to see standard out and error streams inline with the test results
showStandardStreams true
// set to false to hide passed standard out and error streams
showPassedStandardStreams true
// set to false to hide skipped standard out and error streams
showSkippedStandardStreams true
// set to false to hide failed standard out and error streams
showFailedStandardStreams true
}
task unpack(type: Copy) {
dependsOn bootJar
from(zipTree(tasks.bootJar.outputs.files.singleFile))
into("build/dependency")
}
docker {
name "${project.group}/${bootJar.baseName}"
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}
//boot run task
bootRun {}
// make sure bootRun is executed when this task runs
task bootrunDev(dependsOn:bootRun) {
// TaskExecutionGraph is populated only after all the projects in the build have been evaulated
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(bootrunDev)) {
// configure task before it is executed
bootRun {
args = ["--spring.profiles.active=dev"]
logger.lifecycle('*********Setting spring.profiles.active to dev')
}
}
}
}
// make sure bootRun is executed when this task runs
task bootrunQA(dependsOn:bootRun) {
// TaskExecutionGraph is populated only after all the projects in the build have been evaulated
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(bootrunQA)) {
// configure task before it is executed
bootRun {
args = ["--spring.profiles.active=qa"]
logger.lifecycle('**********Setting spring.profiles.active to QA')
}
}
}
}
// make sure bootRun is executed when this task runs
task bootrunProd(dependsOn:bootRun) {
// TaskExecutionGraph is populated only after all the projects in the build have been evaulated
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(bootrunProd)) {
// configure task before it is executed
bootRun {
args = ["--spring.profiles.active=prod"]
logger.lifecycle('**********Setting spring.profiles.active to prod')
}
}
}
}
dependencies {
//boot libs
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-logging")
//compile group: 'com.cloudant', name: 'cloudant-spring-boot-starter', version: '0.0.2'
//Mongo
compile("org.springframework.boot:spring-boot-starter-data-mongodb")
//Sleuth
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth', version: '2.0.1.RELEASE'
//Zipkin
compile "org.springframework.cloud:spring-cloud-starter-zipkin:2.0.1.RELEASE"
//compile "io.zipkin.java:zipkin-server:2.12.2"
//compile "io.zipkin.java:zipkin-autoconfigure-ui:2.12.2"
//Spring cloud starter
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-parent', version: 'Greenwich.RELEASE', ext: 'pom'
//Added to add support for prmoetheus
//micrometer-core
compile group: 'io.micrometer', name: 'micrometer-core', version: '1.1.3'
//micrometer-registry-prometheus
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.1.3'
//Swagger dependencies
compile "io.springfox:springfox-swagger2:2.9.2"
compile "io.springfox:springfox-swagger-ui:2.9.2"
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}