Adding the maven compiler plugin to your maven pom command to use this version of Java:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
However , if both jre and jdk are installed on your system (for a specific version of java), maven may select jre and then complain that it needs a JDK . This can happen after using Maven> Update Project in Eclipse.
To solve this problem, in Eclipse, right-click on the JRE System Library> Properties> Environments and select JavaSE-1.8. If your system has several compatible JREs, select the jdk1.8.x checkbox> OK> select JavaSE-1.8 (jdk1.8.x) as the runtime> OK
Now maven should choose Java version 1.8, and Eclipse will tell maven to use jdk1.8 as the standard JRE for this version of java.
source share