Try with another java version, I was getting same issue after mvn install command,then I switch the java version of my IDE,from java 17 to java 1.8 enter image description here
and went fine, then I was able to generate the jar file, in case you want to install with java 17 , align your pom or gradle file to java 17 version, check latest version for all the dependencies
-Windows -IDE:intelliJ -java version:17 -new java version:8 -maven -springboot 3