How to configure Maven for Java 8/11/17

If you want your Java Maven Project to work with a specific version of Java - 8/11/17, you can do that by adding the below to your pom.xml file.

Configure Java 8 with pom.xml


Configure Java 11 with pom.xml


Configure Java 17 with pom.xml


Example using Maven Compiler Plugin Configuration


By adding the build tag, we tell the Maven Compiler Plugin to use specific Java versions as both the source and target compatibility.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap