#Is there a way to configure default compiler version for a new Maven project in VS Code??

9 messages · Page 1 of 1 (latest)

frank bough
#

Hi everyone! I'm relatively new to Java. I have experience with C#, Go, and Python, and picked up Java for a course I'm taking. I'm using Maven to create projects in VS Code. I have JDK21 installed in my environment, but for some reason Maven always creates new projects with 1.7 as the compiler source and target version. I get a "Problem" reported by VS Code for this. I can go and change it to 21 in the pom.xml every time I create a project, but I'd like to have it done automatically. I tried creating a settings.xml, but either it doesn't work or I did it incorrectly.

Any tips on how I can set up VS Code so that when I create a new project with the Maven plugin, it will use 21 from the beginning?

west spruceBOT
#

This post has been reserved for your question.

Hey @frank bough! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

lunar tusk
#

So if you are using the normal VSC Java plugin, that doesn't support Java 21 yet

#

that being said, you can configure the compiler version in the pom.xml

#

e.g. with a maven.compiler.release property

#

btw you can specify Java 17

frank bough
#

@lunar tusk thanks for the reply, I didn't realize 21 wasn't supported yet.

west spruceBOT