You can update the base image in your Dockerfile to include a newer JDK.
For example, to build with Eclipse Temurin 21, change this line:
FROM maven:3.8.4-openjdk-11
to:
FROM maven:3-eclipse-temurin-21
See here for a list of available Maven base images: https://hub.docker.com/_/maven/tags