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: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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