-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
221 lines (186 loc) · 6.39 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.flywaydb:flyway-database-postgresql:10.20.1")
}
}
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'io.spring.dependency-management' version '1.1.6'
id 'org.flywaydb.flyway' version '10.20.1'
id 'org.springframework.boot' version '3.2.5'
id 'org.owasp.dependencycheck' version '11.1.0'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'se.patrikerdes.use-latest-versions' version '0.2.18'
id 'org.sonarqube' version '5.1.0.4882'
id 'io.gatling.gradle' version '3.10.5.1'
}
group = 'uk.gov.hmcts.reform'
version = '0.0.1'
pmd {
toolVersion = "6.55.0"
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files("config/pmd/ruleset.xml")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
checkstyle {
toolVersion = '10.19.0'
configFile = new File(rootDir, "checkstyle.xml")
maxWarnings = 0
}
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:33.3.1-jre")
}
}
ext {
lombokVersion = '1.18.34'
}
// 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 = 'dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
skipConfigurations = [
"checkstyle",
"compileOnly",
"pmd",
"integrationTest",
"functionalTest",
"smokeTest",
"contractTestRuntimeClasspath",
"contractTestCompileClasspath"
]
}
def springBootVersion = springBoot.class.package.implementationVersion
def springfoxSwagger = '3.0.0'
def javaLoggingVersion = '5.1.9'
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
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')
}
}
}
}
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'ch.qos.logback') {
details.useVersion '1.4.14'
}
}
}
}
dependencies {
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-jdbc'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.4'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.20.1'
implementation group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '10.20.1'
implementation group: 'com.google.guava', name: 'guava', version: '33.3.1-jre'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.7'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.12'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.12'
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'io.rest-assured', name: 'rest-assured'
testImplementation group: 'com.typesafe', name: 'config', version: '1.4.3'
}
application {
mainClass.set('uk.gov.hmcts.reform.rhubarb.recipes.Application')
}
bootJar {
archiveFileName = 'moj-rhubarb-recipes-service.jar'
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
sourceSets {
test {
java.srcDir 'src/test/java'
}
functional {
java.srcDir 'src/test/functional/java'
resources.srcDir 'src/test/resources'
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
apiGateway {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir 'src/test/gateway/java'
}
resources.srcDir 'src/test/gateway/resources'
}
}
configurations {
functionalImplementation.extendsFrom testImplementation
functionalRuntime.extendsFrom testRuntime
apiGatewayImplementation.extendsFrom testImplementation
apiGatewayRuntime.extendsFrom testRuntime
}
task highLevelDataSetup {}
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.rhubarb.functional.SmokeTest'
}
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
testClassesDirs = sourceSets.functional.output.classesDirs
classpath = sourceSets.functional.runtimeClasspath
}
task apiGateway(type: Test, description: 'Runs the smoke tests for API gateway.', group: 'Verification') {
testClassesDirs = sourceSets.apiGateway.output.classesDirs
classpath = sourceSets.apiGateway.runtimeClasspath
}
sonarqube {
properties {
property "sonar.projectName", "cnp-plum-recipes-service"
property "sonar.projectKey", "cnp-plum-recipes-service"
property "sonar.dependencyCheck.reportPath", "${project.buildDir}/reports/dependency-check-report.xml"
property "sonar.coverage.exclusions", "**/config/**, **Exception**"
}
}
test {
useJUnitPlatform()
}
tasks.withType(Test) {
useJUnitPlatform()
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}