版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/heiyouhei123/article/details/82829363
1 方法一
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
2 方法二
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
参考:
https://www.mkyong.com/maven/how-to-tell-maven-to-use-java-8/