generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
260 lines (217 loc) · 9.83 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
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.springframework.boot' version '3.3.5'
id 'org.owasp.dependencycheck' version '10.0.4'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.0.0.4638'
id 'io.freefair.lombok' version '8.6'
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
sourceSets {
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
testClassesDirs = sourceSets.functionalTest.output.classesDirs
classpath = sourceSets.functionalTest.runtimeClasspath
}
task integration(type: Test, description: 'Runs the integration tests.', group: 'Verification') {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
failFast = true
// set your environment variables here
// environment("APPINSIGHTS_INSTRUMENTATIONKEY", "test-key")
}
task smoke(type: Test) {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
task fortifyScan(type: JavaExec) {
main = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
test {
failFast = true
}
checkstyle {
maxWarnings = 0
toolVersion = '10.19.0'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
getConfigDirectory().set(new File(rootDir, 'config/checkstyle'))
}
pmd {
toolVersion = "6.55.0"
ignoreFailures = true
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.functionalTest, sourceSets.integrationTest, sourceSets.smokeTest]
reportsDir = layout.buildDirectory.dir("reports/pmd").get().asFile
ruleSetFiles = files("config/pmd/ruleset.xml")
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required.set(true)
csv.required.set(false)
xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/test/jacocoTestReport.xml"))
}
afterEvaluate {
getClassDirectories().from = getClassDirectories().files.collect {
fileTree(dir: it, exclude: [
'uk/gov/hmcts/reform/bulkscan/payment/processor/config/**'
])
}
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
sonarqube {
properties {
property "sonar.projectName", "Reform :: Bulk Scan Payment Processor"
property "sonar.projectKey", "uk.gov.hmcts.reform:bulk-scan-payment-processor"
property "sonar.coverage.jacoco.xmlReportPaths", jacocoTestReport.reports.xml.outputLocation.get().asFile.absolutePath
property "sonar.exclusions", "**/config/**,**/Application.java,**/service/servicebus/JmsPaymentMessageProcessor.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)
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'true' ? 0 : 11
suppressionFile = 'config/owasp/suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
configurations.all {
exclude group: 'org.springframework.security', module: 'spring-security-rsa'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-security'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
def versions = [
junit : '5.11.0',
junitPlatform : '1.11.0',
reformLogging : '6.0.1',
springBoot : springBoot.class.package.implementationVersion,
openFeign : '13.5'
]
dependencies {
def withoutSpringCloudContext = {
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
}
def withoutJunit4 = {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
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: 'org.springframework.boot', name: 'spring-boot-starter-activemq'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-batch', {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-jdbc'
}
implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version: '5.3.1'
implementation group: 'javax.jms', name: 'javax.jms-api', version: '2.0.1'
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' // Needed for openjdk 11 to execute test
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.reformLogging
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: versions.reformLogging
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '8.0'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '4.1.2'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '3.0.3'
implementation group: 'com.github.hmcts', name: 'ccd-client', version: '5.0.3'
implementation group: 'com.google.guava', name: 'guava', version: '33.3.1-jre'
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '7.5.0'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: '4.1.4'
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.17.3'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.3'
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: versions.openFeign
implementation group: 'io.github.openfeign', name: 'feign-jackson', version: versions.openFeign
implementation group: 'org.apache.qpid', name: 'qpid-jms-client', version: '2.5.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: versions.junit
testImplementation group: 'org.junit.platform', name: 'junit-platform-commons', version: versions.junitPlatform
testImplementation group: 'org.junit.platform', name: 'junit-platform-engine', version: versions.junitPlatform
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.13.0'
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '5.2.0'
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.2.2'
testImplementation group: 'org.apiguardian', name: 'apiguardian-api', version: '1.1.2'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', withoutJunit4
testImplementation group: 'io.github.netmikey.logunit', name: 'logunit-core', version: '2.0.0'
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.4.4', classifier: 'all'
testRuntimeOnly group: 'io.github.netmikey.logunit', name: 'logunit-logback', version: '2.0.0'
integrationTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-contract-wiremock', version: '4.1.4'
integrationTestImplementation sourceSets.main.runtimeClasspath
integrationTestImplementation sourceSets.test.runtimeClasspath
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
smokeTestImplementation group: 'io.rest-assured', name: 'rest-assured', withoutJunit4
smokeTestImplementation group: 'com.typesafe', name: 'config', version: '1.4.3'
}
mainClassName = 'uk.gov.hmcts.reform.bulkscan.payment.processor.Application'
bootJar {
getArchiveFileName().set(provider {
'bulk-scan-payment-processor.jar'
})
manifest {
attributes('Implementation-Version': project.version.toString())
}
}