generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
344 lines (300 loc) · 12.7 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
import java.util.stream.Collectors
buildscript {
dependencies {
classpath "net.serenity-bdd:serenity-single-page-report:4.2.3"
}
}
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.6'
id 'net.serenity-bdd.serenity-gradle-plugin' version '4.2.1'
id 'org.owasp.dependencycheck' version '10.0.4'
id 'org.springframework.boot' version '3.3.4'
id 'uk.gov.hmcts.java' version '0.12.63'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.1.0.4882'
id 'idea'
id 'info.solidsoft.pitest' version '1.15.0'
}
apply from: 'liquibase.gradle'
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
checkstyle {
toolVersion = '10.18.2'
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
jar {
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}
}
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')
}
}
task smokeTest(type: Test, description: 'Runs the smoke tests', group: 'Verification') {
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
task functionalTest(type: Test, description: 'Runs the functional tests', group: 'Verification') {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
finalizedBy aggregate
jar {
duplicatesStrategy(DuplicatesStrategy.INCLUDE)
}
}
tasks.withType(Copy) {
filesMatching("**/*.yaml") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
}
idea {
module {
testSourceDirs += project.sourceSets.smokeTest.java.srcDirs
testSourceDirs += project.sourceSets.smokeTest.resources.srcDirs
testSourceDirs += project.sourceSets.functionalTest.java.srcDirs
testSourceDirs += project.sourceSets.functionalTest.resources.srcDirs
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
tasks.register('functional', Test) {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
finalizedBy aggregate
}
functional.finalizedBy(aggregate)
tasks.register('integration', Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform()
// set your environment variables here
// environment("APPINSIGHTS_INSTRUMENTATIONKEY", "test-key")
}
tasks.register('smoke', Test) {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
checkstyleMain.enabled(false)
checkstyleTest.enabled(false)
pmd {
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.functionalTest, sourceSets.integrationTest, sourceSets.smokeTest]
reportsDir = file("$project.buildDir/reports/pmd")
ruleSets = []
ruleSetFiles = files("config/pmd/ruleset.xml")
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
def listFiles(String pattern) {
return new FileNameFinder()
.getFileNames("${project.rootDir}", pattern)
.stream()
.collect(Collectors.joining(","))
}
def sonarExclusions = [
'**/model/**',
'**/config/**'
]
sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io/"
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec"
property "sonar.dependencyCheck.reportPath", "${project.buildDir}/reports/dependency-check-report.xml"
property "sonar.exclusions", sonarExclusions.join(", ")
property "sonar.test.exclusions", sonarExclusions.join(", ")
property "sonar.coverage.exclusions", sonarExclusions.join(", ")
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
property "sonar.projectName", "CCPAY :: Bulkscanning payment"
property "sonar.projectKey", "uk.gov.hmcts.reform:ccpay-bulkscanning-api"
property "sonar.organization", "hmcts"
}
}
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')
}
}
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2023.0.3'
mavenBom 'org.apache.logging.log4j:log4j-bom:2.24.1'
}
}
def versions = [
apachePoi : '5.3.0',
hmctsLogging : '6.1.6',
log4j : '2.24.1',
lombok : '1.18.34',
springBoot : springBoot.class.package.implementationVersion,
sonarPitest : '0.5',
serenity : '4.2.3',
serenityCucumber : '4.2.3'
]
apply from: "${rootDir}/cve-resolution-strategy.gradle"
dependencies {
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: versions.hmctsLogging
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.hmctsLogging
implementation group: 'com.github.hmcts', name: 'auth-checker-lib', version: '3.0.3'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '3.0.3'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '5.2.0'
implementation group: 'com.google.guava', name: 'guava', version: '33.3.1-jre'
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.41.2'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'commons-io', name: 'commons-io', version: '2.17.0'
implementation group: 'io.github.openfeign.querydsl', name: 'querydsl-jpa', version: '6.8'
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: '13.5'
implementation group: 'io.github.openfeign', name: 'feign-jackson', version: '13.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version:'0.12.6'
implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.1.0'
implementation group: 'joda-time', name: 'joda-time', version: '2.13.0'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '7.4'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: versions.log4j
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: versions.log4j
implementation group: 'org.apache.poi', name: 'poi-ooxml-lite', version: versions.apachePoi
implementation group: 'org.apache.poi', name: 'poi', version: versions.apachePoi
implementation group: 'org.codehaus.sonar-plugins', name: 'sonar-pitest-plugin', version: versions.sonarPitest
implementation group: 'org.jboss.aerogear', name: 'aerogear-otp-java', version:'1.0.0'
implementation group: 'org.liquibase', name: 'liquibase-core', version: '4.27.0'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.4'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-client'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-resource-server'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
implementation group: 'org.springframework.security', name: 'spring-security-config'
implementation group: 'org.springframework.security', name: 'spring-security-web'
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.4.4', classifier: 'all'
testImplementation group: 'com.h2database', name: 'h2'
testImplementation group: 'io.rest-assured', name: 'rest-assured'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-test-autoconfigure'
testImplementation group: 'org.springframework.security', name: 'spring-security-test'
testImplementation group: 'org.testcontainers', name: 'postgresql', version: '1.20.2'
testImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: versions.lombok
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
smokeTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-cucumber', version: versions.serenityCucumber
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
smokeTestImplementation sourceSets.test.runtimeClasspath
}
application {
mainClass = 'uk.gov.hmcts.reform.bulkscanning.BulkScanningApiApplication'
def jarName = 'bulk-scanning-payment-api.jar'
bootJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = jarName
manifest {
attributes 'Implementation-Title': project.name, 'Implementation-Version': project.version
}
}
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
html.outputLocation = file("${buildDir}/build/jacoco")
}
afterEvaluate {
getClassDirectories().from = getClassDirectories().files.collect {
fileTree(dir: it, exclude: [
'uk/gov/hmcts/reform/bulkscanning/config/**'
])
}
}
}
dependencyCheck {
suppressionFile = 'config/owasp/suppressions.xml'
}
test {
finalizedBy jacocoTestReport
jacoco {
destinationFile = file("${project.rootDir}/build/jacoco/test.exec")
}
}
task fortifyScan(type: JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
serenity {
reports = ["single-page-html"]
}
run {
def debug = System.getProperty("debug")
if (debug == 'true') {
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005']
}
}
bootRun {
//…other settings, like...
mainClass = 'uk.gov.hmcts.reform.bulkscanning.BulkScanningApiApplication'
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.bulkscanning.*']
excludedClasses = ['uk.gov.hmcts.reform.bulkscanning.config.*',
'uk.gov.hmcts.reform.bulkscanning.mapper.*',
'uk.gov.hmcts.reform.bulkscanning.model.*',
'uk.gov.hmcts.reform.bulkscanning.exception.*']
threads = 10
outputFormats = ['XML', 'HTML']
mutationThreshold = 90
}