There’s a couple of different ways to configure the Java version for an app in your Maven pom.xml file.
The simplest is with the following properties:
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
If you’re configuring a Spring Boot app with Maven, you can also use this single property (only works for a Spring Boot app using the starter parent spring-boot-starter-parent) to override the Spring Boot default:
<properties>
<java.version>17</java.version>
</properties>