I'm not sure this is the issue you are referencing, but you can use multi-stage Docker image builds to avoid bundling the JDK in the final Docker image:
FROM openjdk:jdk AS build
COPY . .
RUN mvn package
FROM openjdk:jre
COPY --from=build ./somepath/app.jar .
CMD java app.jar
The first stage (defined by the first FROM) is only used to build the ".jar", the second stage will only contain the JRE and the ".jar" copied from the first stage.