generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
321 lines (267 loc) · 11.5 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
plugins {
id 'application'
id 'jacoco'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'org.springframework.boot' version '2.7.18'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.1.0.4882'
id 'uk.gov.hmcts.java' version '0.12.63'
}
group = 'uk.gov.hmcts.reform.ccd'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/smokeTest/java')
}
resources.srcDir file('src/smokeTest/resources')
}
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
task integration(type: Test, description: 'Runs the integration tests.', group: 'Verification') {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform{
includeTags 'integration'
}
// set your environment variables here
environment("WIREMOCK_SERVER_MAPPINGS_PATH", "wiremock")
}
task smoke(type: Test) {
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
useJUnitPlatform {
includeTags 'smoke'
}
}
task functional(type: Test) {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
useJUnitPlatform {
includeTags 'functional'
}
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
xml.outputLocation = file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
check.dependsOn integration
project.tasks['sonarqube'].dependsOn test, integration, jacocoTestReport
sonarqube {
properties {
property "sonar.projectName", "Reform :: ccd-test-stubs-service"
property "sonar.projectKey", "uk.gov.hmcts.reform:ccd-test-stubs-service"
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
property "sonar.jacoco.itReportPath", "${project.buildDir}/jacoco/integration.exec"
property "sonar.junit.reportPaths", "${project.buildDir}/test-results/junit-platform"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.outputLocation}"
}
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
apply from: './gradle/suppress.gradle'
dependencyCheck {
suppressionFile = 'dependency-check-suppressions.xml'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
ext {
groovyVersion = '3.0.7'
tomcatVersion = '9.0.83'
jettyVersion = '9.4.53.v20231009'
}
ext['spring-framework.version'] = '5.3.27'
ext['spring-security.version'] = '5.8.10'
ext['log4j2.version'] = '2.17.1'
ext['jackson.version'] = '2.16.0'
ext['snakeyaml.version'] = '2.0'
// it is important to specify logback classic and core packages explicitly as libraries like spring boot
// enforces it's own (older) version which is not recommended.
def versions = [
junit : '5.3.2',
reformLogging : '6.0.1',
springBoot : '3.0',
springfoxSwagger: '3.0.0',
]
dependencies {
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: '3.1.8'
implementation group: 'com.google.guava', name: 'guava', version:'32.1.2-jre'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
implementation "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
implementation "org.apache.tomcat.embed:tomcat-embed-el:${tomcatVersion}"
implementation "org.apache.tomcat.embed:tomcat-embed-websocket:${tomcatVersion}"
// CVE-2021-28170
implementation group: 'org.glassfish', name: 'jakarta.el', version: '4.0.1'
// CVE-2021-42550
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.reformLogging
implementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.10.RELEASE') {
exclude group: 'org.springframework.security', module: 'spring-security-rsa'
}
// https://mvnrepository.com/artifact/com.github.tomakehurst/wiremock
implementation(group: 'com.github.tomakehurst', name: 'wiremock-jre8', version: '2.35.2')
// https://mvnrepository.com/artifact/com.github.jknack/handlebars
implementation group: 'com.github.jknack', name: 'handlebars', version: '4.3.1'
implementation group: 'org.eclipse.jetty', name: 'jetty-server', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-client', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-java-client', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-java-server', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-openjdk8-client', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-openjdk8-server', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-continuation', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-util', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-util-ajax', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-xml', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-client', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-security', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-http', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-io', version: jettyVersion
implementation group: 'org.eclipse.jetty.http2', name: 'http2-server', version: jettyVersion
implementation group: 'org.eclipse.jetty.http2', name: 'http2-common', version: jettyVersion
implementation group: 'org.eclipse.jetty.http2', name: 'http2-hpack', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-servlet', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-servlets', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-webapp', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-proxy', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-server', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-conscrypt-server', version: jettyVersion
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-conscrypt-client', version: jettyVersion
implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: groovyVersion
implementation group: 'org.codehaus.groovy', name: 'groovy', version: groovyVersion
implementation group: 'org.codehaus.groovy', name: 'groovy-xml', version: groovyVersion
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.37.2'
implementation group: 'org.springframework.security', name: 'spring-security-crypto'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: versions.junit
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation(group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0') {
exclude group: 'org.apache.sling', module: 'org.apache.sling.javax.activation'
}
testImplementation group: 'io.rest-assured', name: 'json-path', version: '4.3.0'
testImplementation(group: 'io.rest-assured', name: 'xml-path', version: '4.3.0') {
exclude group: 'org.apache.sling', module: 'org.apache.sling.javax.activation'
}
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
testImplementation 'com.github.hmcts:fortify-client:1.3.0:all'
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
implementation group: 'junit', name: 'junit', version: '4.13.1'
implementation group: 'net.minidev', name: 'json-smart', version: '2.4.9'
// CCD-3511 CVE-2020-15522
implementation group: 'org.bouncycastle', name: 'bcpkix-jdk15to18', version: '1.77'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.8'
implementation('org.springframework.cloud:spring-cloud-starter'){
version {
strictly '3.1.8'
}
}
implementation('org.springframework.boot:spring-boot-starter'){
version {
strictly '3.1.8'
}
}
implementation('org.springframework.security:spring-security-rsa'){
version {
strictly '1.0.12.RELEASE'
}
}
implementation('org.bouncycastle:bcpkix-jdk18on') {
version {
strictly '1.77'
}
}
}
test {
useJUnitPlatform()
failFast = true
}
application {
mainClass = 'uk.gov.hmcts.reform.ccd.test.stubs.service.Application'
}
bootJar {
archiveFileName = 'ccd-test-stubs-service.jar'
manifest {
attributes('Implementation-Title': project.name)
attributes('Implementation-Version': project.version.toString())
}
from('wiremock/mappings') {
into 'wiremock/mappings'
}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.1"
}
}
// for cnp pipeline
task dependencyCheck(dependsOn: dependencyCheckAnalyze)
task fortifyScan(type: JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}