-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
269 lines (235 loc) · 10.4 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
plugins {
id 'application'
id 'jacoco'
id 'checkstyle'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '2.7.18'
id 'org.owasp.dependencycheck' version '10.0.4'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.sonarqube' version '5.1.0.4882'
id 'pmd'
}
group = 'uk.gov.hmcts.et'
version = '0.0.1'
checkstyle {
maxWarnings = 0
toolVersion = '10.21.1'
}
pmd {
toolVersion = "6.55.0"
sourceSets = [sourceSets.main, sourceSets.test]
reportsDir = file("$project.buildDir/reports/pmd")
// https://github.com/pmd/pmd/issues/876
ruleSets = []
ruleSetFiles = files("config/pmd/ruleset.xml")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
def sonarExclusions = ['**/uk/gov/hmcts/reform/ethos/ecm/consumer/config/**',
'**/uk/gov/hmcts/reform/ethos/ecm/consumer/model/**',
'**/uk/gov/hmcts/reform/ethos/ecm/consumer/domain/**',
'**/uk/gov/hmcts/reform/ethos/ecm/consumer/tasks/**',
'**/uk/gov/hmcts/reform/ethos/ecm/consumer/Application'
]
sonarqube {
properties {
property "sonar.exclusions", sonarExclusions.join(', ')
property "sonar.projectKey", "et-message-handler"
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.dependencyCheck.reportPath", "${project.buildDir}/reports/dependency-check-report.xml"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
sourceSets {
test {
java.srcDir 'src/test/java'
}
functional {
java.srcDir 'src/test/functional/java'
resources.srcDir 'src/test/functional/resources'
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
functionalImplementation.extendsFrom testImplementation
functionalRuntimeOnly.extendsFrom testRuntimeOnly
}
test {
exclude '**/*ComponentTest*'
useJUnitPlatform()
}
task smoke(type: Test, description: 'Runs the smoke tests.', group: 'Verification') {
testClassesDirs = sourceSets.functional.output.classesDirs
classpath = sourceSets.functional.runtimeClasspath
useJUnit {
includeCategories 'uk.gov.hmcts.reform.ethos.ecm.consumer.functional.SmokeTest'
}
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
testClassesDirs = sourceSets.functional.output.classesDirs
classpath = sourceSets.functional.runtimeClasspath
useJUnit {
includeCategories 'uk.gov.hmcts.reform.ethos.ecm.consumer.functional.SmokeTest'
includeCategories 'uk.gov.hmcts.reform.ethos.ecm.consumer.functional.HealthCheckTest'
}
maxHeapSize = '1G'
}
task fortifyScan(type: JavaExec) {
main = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
// 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
}
analyzers.nodeAudit.yarnEnabled = false
}
dependencyManagement {
dependencies {
dependency group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.70'
// CVE-2018-10237 - Unbounded memory allocation
dependencySet(group: 'com.google.guava', version: '33.4.0-jre') {
entry 'guava'
}
}
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
}
ext {
junitJupiterVersion = '5.10.2'
feignVersion = '13.5'
junitPlatform = '1.6.2'
log4JVersion = '2.24.3'
logbackVersion = '1.5.9'
serenity = '4.2.12'
springBoot = springBoot.class.package.implementationVersion
tomcatEmbedVersion = '9.0.98'
nettyVersion = '4.1.107.Final'
}
ext["rest-assured.version"] = '5.1.0'
dependencies {
implementation 'com.github.hmcts:et-common:2.5.2'
implementation 'com.github.hmcts:et-data-model:3.18.27'
implementation 'com.github.hmcts:ecm-common:2.0.5'
implementation 'com.github.hmcts:ecm-data-model:1.3.12'
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.netty') {
details.useVersion nettyVersion
}
}
}
implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '6.4.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.5'
implementation group: 'ch.qos.logback', name: 'logback-core', version: logbackVersion
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.7'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0'
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.47'
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: feignVersion
implementation group: 'io.github.openfeign', name: 'feign-core', version: feignVersion
implementation group: 'junit', name: 'junit', version: '4.13.2'
implementation group: 'net.javacrumbs.shedlock', name: 'shedlock-spring', version: '5.16.0'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.27.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
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.apache.pdfbox', name: 'pdfbox', version: '3.0.3'
implementation group: 'org.apache.santuario', name: 'xmlsec', version: '4.0.3'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: tomcatEmbedVersion
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: tomcatEmbedVersion
//to remove CVEs
implementation group: 'org.apache.xmlgraphics', name: 'batik-all', version: '1.18', ext: 'pom'
implementation group: 'org.apache.xmlgraphics', name: 'xmlgraphics-commons', version: '2.10'
implementation group: 'commons-net', name: 'commons-net', version: '3.11.1'
implementation group: 'com.fasterxml.woodstox', name: 'woodstox-core', version: '7.1.0'
implementation('org.elasticsearch:elasticsearch') {
version {
strictly '7.17.4'
}
}
implementation group: 'com.squareup.okio', name: 'okio', version: '3.9.1'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '9.22.3'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.5'
// CVE-2022-25857
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.3'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.8.0'
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'com.microsoft.azure', name: 'adal4j', version: '1.6.7'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '3.1.9'
implementation 'org.springframework.retry:spring-retry'
implementation group: 'org.testng', name: 'testng', version: '7.10.2'
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '5.2.1-RELEASE'
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 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.mockito:mockito-junit-jupiter:5.14.2'
testImplementation group: 'com.auth0', name: 'java-jwt', version: '4.4.0'
testImplementation 'com.github.hmcts:fortify-client:1.4.6:all'
testImplementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
testImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: serenity, {
exclude module: 'jaxb-osgi'
}
testImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: serenity
testImplementation (group: 'org.docx4j', name: 'docx4j', version: '6.1.2') {
exclude module: 'slf4j-log4j12'
}
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
mainClassName = 'uk.gov.hmcts.reform.ethos.ecm.consumer.Application'
bootJar {
getArchiveFileName().set(provider {
'et-msg-handler.jar'
})
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}