You can specify the JDK to build Maven using the following plugin;
Apache Maven compiler plugin .
<project>
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
...
</project>
Trying to compile Java1.7 code with JDK 1.6 will really cause problems.
You can also use the property java.versionto indicate your version of Java, as described here , you can see the usage maven-compiler-pluginin spring-boot-parentpom.xml, here
.