POM文件中加上下面配置

    1. <build>
    2. <plugins>
    3. <plugin>
    4. <groupId>org.apache.maven.plugins</groupId>
    5. <artifactId>maven-compiler-plugin</artifactId>
    6. <configuration>
    7. <source>1.8</source>
    8. <target>1.8</target>
    9. </configuration>
    10. </plugin>
    11. </plugins>
    12. </build>