If when you say, “I have a Maven project”, you mean, “I have a Jenkins job definition that uses the maven integration plugin”, then you have a job defined with a Jenkins job type that is strongly coupled to the version of Java running your controller. That’s a bad thing because that means that job type will run with Java 11 while your controller is running Java 11 and then will run with Java 17 when you (eventually) switch your controller to Java 17.
The documentation of the maven integration plugin says:
The Jenkins project recommends that users transition from the Maven job type to use Pipeline jobs or freestyle jobs.
An article from CloudBees offers some other alternatives that you may be able to use during your transition from the Maven job type to Pipeline.
There is also a video from Darin Pope that offers ways that Jenkins controllers can provide many different Java versions for use by jobs on those controllers. Those techniques will allow Pipeline jobs and freestyle jobs to use the Java version of their choice while the Jenkins controller runs Java 11 or Java 17. We use those techniques on ci.jenkins.io to build and test with Java 11, Java 17, Java 19, and even Java 8 using Pipeline jobs.