Skip to content

Commit 132bee1

Browse files
CCD-5269 : Spring Boot 3 Upgrade (#156)
* Spring Boot 3 Upgrade * Fix sonar xmlReportPaths * Bump all to latest versions * whitespace change * Added classifier to fix fortify import * OCI job chart --------- Co-authored-by: RebeccaBaker <[email protected]>
1 parent c63eae8 commit 132bee1

File tree

15 files changed

+153
-195
lines changed

15 files changed

+153
-195
lines changed

build.gradle

Lines changed: 65 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ plugins {
33
id 'checkstyle'
44
id 'jacoco'
55
id 'java'
6-
id "io.freefair.lombok" version "8.10.2"
7-
id 'io.spring.dependency-management' version '1.1.0'
8-
id 'org.springframework.boot' version '2.7.18'
9-
id 'com.github.kt3k.coveralls' version '2.12.2'
106
id 'com.github.ben-manes.versions' version '0.51.0'
11-
id 'org.sonarqube' version '5.1.0.4882'
7+
id 'com.github.kt3k.coveralls' version '2.12.2'
8+
id 'io.freefair.lombok' version '8.12'
9+
id 'io.spring.dependency-management' version '1.1.7'
10+
id 'org.owasp.dependencycheck' version '11.1.1'
11+
id 'org.sonarqube' version '6.0.1.5171'
12+
id 'org.springframework.boot' version '3.4.1'
1213
id 'uk.gov.hmcts.java' version '0.12.63'
1314
}
1415

@@ -21,6 +22,10 @@ java {
2122
}
2223
}
2324

25+
application {
26+
mainClass = 'uk.gov.hmcts.ccd.casemigration.CaseMigrationRunner'
27+
}
28+
2429
sourceSets {
2530
functionalTest {
2631
java {
@@ -61,13 +66,6 @@ configurations {
6166
smokeTestRuntimeOnly.extendsFrom runtimeOnly
6267
}
6368

64-
//configurations.all {
65-
// resolutionStrategy.dependencySubstitution {
66-
// substitute module("ch.qos.logback:logback-classic:1.2.12") with project('ch.qos.logback:logback-classic:1.3.14')
67-
// substitute module("ch.qos.logback:logback-core:1.2.12") with project('ch.qos.logback:logback-core:1.3.14')
68-
// }
69-
//}
70-
7169
tasks.withType(JavaCompile) {
7270
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
7371
}
@@ -85,10 +83,6 @@ tasks.withType(Test) {
8583
}
8684
}
8785

88-
test {
89-
failFast = true
90-
}
91-
9286
task functional(type: Test) {
9387
description = "Runs functional tests"
9488
group = "Verification"
@@ -139,7 +133,7 @@ sonarqube {
139133
property "sonar.projectName", "ccd-case-migration-starter"
140134
property "sonar.projectKey", "ccd-case-migration-starter"
141135
property "sonar.exclusions", "**/exception/*.java,**/domain/*.java,**/common/*.java,**/migration/auth/AuthTokenGeneratorConfiguration.java,**/migration/CaseMigrationRunner.java,**/ccd/HttpMessageConverterConfiguration.java"
142-
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.outputLocation}"
136+
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
143137
}
144138
}
145139

@@ -164,102 +158,76 @@ dependencyCheck {
164158
repositories {
165159
mavenLocal()
166160
mavenCentral()
167-
maven { url 'https://jitpack.io' }
161+
maven { url = 'https://jitpack.io' }
168162
}
169163

170164
ext {
171-
log4JVersion = "2.20.0"
172-
restAssuredVersion = '4.3.0!!'
173-
lombokVersion = "1.18.34"
174-
junit_version = "4.12"
175-
junitJupiterVersion = '5.9.3'
176-
junitVintageVersion = '5.9.3'
177-
powermockVersion = '2.0.9'
178-
springSecurity = '5.8.15'
179-
springCloudVersion = '2021.0.7'
165+
set('springCloudVersion', '2024.0.0')
166+
set('spring-framework.version', '6.2.1')
167+
set('spring-security.version', '6.4.2')
168+
set('jackson.version', '2.18.2')
169+
set('snakeyaml.version', '2.3')
170+
log4JVersion = '2.24.3'
171+
junitVersion = '5.11.4'
172+
junitPlatform = '1.11.4'
173+
174+
libraries = [
175+
junit5: [
176+
"org.junit.jupiter:junit-jupiter-api:${junitVersion}",
177+
"org.junit.jupiter:junit-jupiter-engine:${junitVersion}",
178+
"org.junit.jupiter:junit-jupiter-params:${junitVersion}",
179+
"org.junit.platform:junit-platform-commons:${junitPlatform}",
180+
"org.junit.platform:junit-platform-engine:${junitPlatform}",
181+
"org.apiguardian:apiguardian-api:1.1.2"
182+
]
183+
]
180184
}
181185

182-
ext['jackson.version'] = '2.16.0'
183-
ext['snakeyaml.version'] = '2.0'
184-
ext['spring-security.version'] = '5.8.15'
185-
186186
dependencies {
187-
//implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.37.2' //Fix for CVE-2023-52428
188-
189-
implementation("org.springframework.cloud:spring-cloud-starter-bootstrap")
190-
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
191-
192-
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
193-
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
194-
implementation group: 'org.springframework', name: 'spring-context-support'
195-
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '1.5.5'
196-
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '3.1.4'
197-
implementation group: 'com.github.hmcts', name: 'core-case-data-store-client', version: '4.9.2'
198187

199-
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
200-
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.33.2'
188+
// start::CVE Vulnerability dependency overrides // MAIN PARENT DEPENDEDNCY
189+
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5' // idam-java-client
190+
implementation group: 'commons-io', name: 'commons-io', version: '2.17.0' // idam-java-client
191+
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion // spring-cloud-starter-bootstrap
192+
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4JVersion // spring-cloud-starter-bootstrap
201193

202-
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.7.0'
194+
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version:'5.15.2' // spring-boot-starter-test
203195

204-
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.0.1'
205-
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.6'
206-
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.6'
196+
// end::CVE Vulnerability dependency overrides // MAIN PARENT DEPENDEDNCY
207197

208-
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion
209-
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4JVersion
210-
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '4.5.1'
198+
// SPRING
199+
implementation group: 'org.springframework', name: 'spring-context-support'
200+
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
211201

202+
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
203+
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
204+
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap'
205+
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server'
206+
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client'
207+
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose'
208+
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core'
209+
implementation group: 'org.springframework.security', name: 'spring-security-config'
210+
211+
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.1'
212+
213+
// HMCTS
214+
implementation group: 'com.github.hmcts', name: 'ccd-client', version: '5.0.3'
215+
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '3.0.3'
216+
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '5.2.0'
217+
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.6'
218+
219+
testImplementation libraries.junit5
220+
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.4.6', classifier: 'all'
221+
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '5.5.0'
212222
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
223+
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-contract-stub-runner', version: '4.1.4'
213224

214-
testImplementation('org.junit.jupiter:junit-jupiter:5.9.3')
215-
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
216-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
217-
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}"
218-
testImplementation group:'org.mockito', name: 'mockito-junit-jupiter', version:'3.12.4'
219-
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: powermockVersion
220-
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
221-
testRuntimeOnly "org.junit.platform:junit-platform-commons:1.9.3"
222-
implementation group: 'org.projectlombok', name: 'lombok', version: lombokVersion
223-
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
224-
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
225-
226-
testImplementation 'com.github.hmcts:fortify-client:1.3.0:all'
227-
228-
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
229-
implementation group: 'commons-io', name: 'commons-io', version: '2.12.0'
230-
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: springSecurity
231-
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client', version: springSecurity
232-
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: springSecurity
233-
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: springSecurity
234-
implementation group: 'org.springframework.security', name: 'spring-security-config', version: springSecurity
235225
}
236226

237227
dependencyManagement {
238228
imports {
239229
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
240230
}
241-
242-
dependencies {
243-
dependency 'com.google.guava:guava:30.1.1-jre'
244-
245-
dependencySet(group: 'commons-beanutils', version: '1.9.4') {
246-
entry 'commons-beanutils'
247-
}
248-
249-
dependencySet(group: 'io.rest-assured', version: '4.5.1') {
250-
entry 'json-path'
251-
entry 'xml-path'
252-
}
253-
dependencySet(group: 'org.codehaus.groovy', version: '3.0.17') {
254-
entry 'groovy'
255-
entry 'groovy-xml'
256-
entry 'groovy-json'
257-
}
258-
}
259-
}
260-
261-
application {
262-
mainClass = 'uk.gov.hmcts.reform.migration.CaseMigrationRunner'
263231
}
264232

265233
bootJar {
@@ -272,27 +240,21 @@ wrapper {
272240
distributionType = Wrapper.DistributionType.ALL
273241
}
274242

275-
configurations.all {
276-
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
277-
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
278-
exclude group: 'org.springframework.security', module: 'spring-security-rsa'
279-
exclude group: 'ch.qos.logback', module: 'logback-classic'
280-
}
281-
282243
test {
283244
timeout = Duration.ofMinutes(30)
284245
environment("AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY", "some-key")
285246
systemProperty 'java.locale.providers', 'COMPAT'
247+
failFast = true
286248

287249
useJUnitPlatform()
288250

289251
testLogging {
290252
events "failed"
291-
exceptionFormat "short"
253+
exceptionFormat = "short"
292254

293255
debug {
294256
events "passed", "started", "skipped", "failed"
295-
exceptionFormat "full"
257+
exceptionFormat = "full"
296258
}
297259

298260
info.events = ["failed", "skipped"]

config/owasp/suppressions.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?><suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
2-
<suppress>
3-
<notes>
4-
CVE-2023-52428 refer [https://tools.hmcts.net/jira/browse/CCD-6285]
5-
CVE-2024-38820 refer [https://tools.hmcts.net/jira/browse/CCD-6278]
6-
</notes>
7-
<cve>CVE-2023-52428</cve>
8-
<cve>CVE-2024-38820</cve>
9-
</suppress>
102
</suppressions>

gradle/wrapper/gradle-wrapper.jar

-19.3 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,7 +85,9 @@ done
8385
# This is normally unused
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
88+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
8791

8892
# Use the maximum available, or set MAX_FD != -1 to use that value.
8993
MAX_FD=maximum
@@ -144,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144148
case $MAX_FD in #(
145149
max*)
146150
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
151+
# shellcheck disable=SC2039,SC3045
148152
MAX_FD=$( ulimit -H -n ) ||
149153
warn "Could not query maximum file descriptor limit"
150154
esac
151155
case $MAX_FD in #(
152156
'' | soft) :;; #(
153157
*)
154158
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
159+
# shellcheck disable=SC2039,SC3045
156160
ulimit -n "$MAX_FD" ||
157161
warn "Could not set maximum file descriptor limit to $MAX_FD"
158162
esac
@@ -201,11 +205,11 @@ fi
201205
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202206
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203207

204-
# Collect all arguments for the java command;
205-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
206-
# shell script including quotes and variable substitutions, so put them in
207-
# double quotes to make sure that they get re-expanded; and
208-
# * put everything else in single quotes, so that it's not re-expanded.
208+
# Collect all arguments for the java command:
209+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210+
# and any embedded shellness will be escaped.
211+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212+
# treated as '${Hostname}' itself on the command line.
209213

210214
set -- \
211215
"-Dorg.gradle.appname=$APP_BASE_NAME" \

gradlew.bat

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
4345
%JAVA_EXE% -version >NUL 2>&1
4446
if %ERRORLEVEL% equ 0 goto execute
4547

46-
echo.
47-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48-
echo.
49-
echo Please set the JAVA_HOME variable in your environment to match the
50-
echo location of your Java installation.
48+
echo. 1>&2
49+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50+
echo. 1>&2
51+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52+
echo location of your Java installation. 1>&2
5153

5254
goto fail
5355

@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5759

5860
if exist "%JAVA_EXE%" goto execute
5961

60-
echo.
61-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62-
echo.
63-
echo Please set the JAVA_HOME variable in your environment to match the
64-
echo location of your Java installation.
62+
echo. 1>&2
63+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64+
echo. 1>&2
65+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66+
echo location of your Java installation. 1>&2
6567

6668
goto fail
6769

0 commit comments

Comments
 (0)