Issue
I am new to eclipse and trying to run a spring application with a number of modules. I am setting the build path and compiler to use jdk 1.8 but when I run maven install it is building the project using JRE 1.5 for all the modules somehow. I checked the pom.xml but no where the compiler version was defined. I wanted to know if anyone can help me with the reasons why I may be facing this issue.
Solution
If you want to make sure that newly created projects in Eclipse use another default java version than Java 1.5, you can change the configuration in the maven-compiler-plugin.
Go to the folder .m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.1 Open maven-compiler-plugin-3.1.jar with a zip program. Go to META-INF/maven and open the plugin.xml In the following lines:
${maven.compiler.source} ${maven.compiler.target}change the default-value to 1.7 or 1.8 or whatever you like.
Save the file and make sure it is written back to the zip file. From now on, all new Maven projects use the java version you specified.
Information is from the following blog post: https://sandocean.wordpress.com/2019/03/22/directly-generating-maven-projects-in-eclipse-with-java-version-newer-than-1-5/
More Link : Why Maven project is tied to J2SE-1.5 by default?
Answered By - Umeshwaran
Answer Checked By - Marilyn (JavaFixing Volunteer)