generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
257 lines (218 loc) · 9.59 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
plugins {
id 'application'
id 'checkstyle'
id 'idea'
id 'jacoco'
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.owasp.dependencycheck' version '11.0.0'
id 'io.spring.dependency-management' version '1.1.5'
id 'org.sonarqube' version '5.1.0.4882'
id 'org.springframework.boot' version '3.3.5'
id 'uk.gov.hmcts.java' version '0.12.57'
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
application {
mainClass = 'uk.gov.hmcts.reform.hmc.ApplicationBootstrap'
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
}
idea {
module {
// config to allow Intellij to mark test source and resource files correctly to help linting tools
testSourceDirs += project.sourceSets.functionalTest.java.srcDirs
testSourceDirs += project.sourceSets.integrationTest.java.srcDirs
testResourceDirs += project.sourceSets.functionalTest.resources.srcDirs
testResourceDirs += project.sourceSets.integrationTest.resources.srcDirs
}
}
configurations {
functionalTestImplementation.extendsFrom testImplementation
functionalTestRuntimeOnly.extendsFrom runtimeOnly
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
smokeTestImplementation.extendsFrom testImplementation
smokeTestRuntimeOnly.extendsFrom runtimeOnly
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
// https://github.com/gradle/gradle/issues/16791
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
task functional(type: Test) {
description = "Runs functional tests"
group = "Verification"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task integration(type: Test) {
description = "Runs integration tests"
group = "Verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
failFast = true
mustRunAfter test
}
checkstyle {
toolVersion '10.3.1'
}
tasks.withType(Checkstyle) {
exclude '**/package-info.java'
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
xml.outputLocation = file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
project.tasks['check'].dependsOn integration
sonarqube {
properties {
property "sonar.projectName", "Reform :: hmc-operational-reports-runner"
property "sonar.projectKey", "uk.gov.hmcts.reform:hmc-operational-reports-runner"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
property "sonar.coverage.exclusions", "**/hmc/ApplicationBootstrap.java"
property "sonar.exclusions","**/hmc/ApplicationExecutor.java"
}
}
// before committing a change, make sure task still works
dependencyUpdates {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
rejectVersionIf { selection -> // <---- notice how the closure argument is named
return isNonStable(selection.candidate.version) && !isNonStable(selection.currentVersion)
}
}
apply from: './gradle/suppress.gradle'
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
suppressionFile = 'config/owasp/suppressions.xml'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext {
set('spring-framework.version', '6.1.14')
set('spring-security.version', '6.3.4')
set('springCloudVersion', '2023.0.3')
set('jackson.version', '2.18.0')
set('snakeyaml.version', '2.3')
log4JVersion = "2.24.1"
slf4jVersion = "2.0.16"
logbackVersion = "1.5.11"
reformLogging= '6.0.1'
lombokVersion = '1.18.34'
junitJupiterVersion = '5.10.5'
junitVintageVersion = '5.10.5'
junitPlatform = '1.7.2'
powermockVersion = '2.0.9'
testcontainers = '1.20.3'
}
dependencies {
// SPRING
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-cache'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.retry', name: 'spring-retry'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
// HMCTS
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: reformLogging
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: reformLogging
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '5.2.1-RELEASE'
implementation group: 'org.json', name: 'json', version: '20240303'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '10.1.31'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '10.1.31'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'commons-io', name: 'commons-io', version: '2.17.0'
implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '2.1.1'
implementation group: 'jakarta.inject', name: 'jakarta.inject-api', version: '2.0.1'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.18.0'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '8.0'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
implementation group: 'ch.qos.logback', name: 'logback-core', version: logbackVersion
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: slf4jVersion
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter', version: '2.6.4'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4JVersion
implementation group: 'org.hibernate.orm', name: 'hibernate-core', version: '6.1.7.Final'
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
runtimeOnly group: 'org.postgresql', name: 'postgresql', version: '42.7.4'
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.5'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.5'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2'
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9'
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.9'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-contract-stub-runner', version: '4.1.4'
testImplementation group: 'org.testcontainers', name: 'postgresql', version: testcontainers
testImplementation group: 'org.testcontainers', name: 'junit-jupiter', version: testcontainers
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
integrationTestImplementation group: 'org.wiremock', name: 'wiremock', version: '3.9.2'
integrationTestImplementation group: 'net.minidev', name: 'json-smart', version: '2.5.1'
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation group: 'com.github.hmcts', name: 'befta-fw', version: '9.1.0'
}
bootJar {
archiveFileName = "hmc-operational-reports-runner.jar"
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
// Gradle 7.x issue, workaround from: https://github.com/gradle/gradle/issues/17236#issuecomment-894768083
rootProject.tasks.named("processIntegrationTestResources") {
duplicatesStrategy = 'include'
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}