The reason is that Maven defaults to using version 1.4 or 1.5. Navigate to the Maven installation directory and modify the version configuration file to fix this.
Here I’ll use my installation path as an example:
cd /usr/local/apache-maven/conf
vi settings.xml
Scroll down near the bottom to the JDK section and add the following code:

Code download: https://www.cnop.net/uploadfile/2016/1009/20161009064430756.zip