因为版本不同,每次运行main方法进行测试的时候都会报以下错误:
Error:java: Compilation failed: internal java compiler error
所以每次都得去 设置里面改回来,用起来很是麻烦
但是现在有一种非常好用的方法,就是直接修改maven 的配置文件,
我们先看看使用的maven 是哪个版本的,版本下会直接显示出maven 的目录地址,
先进入maven3目录下的conf目录,settings.xml文件就藏在这里;
我们打开 settings.xml文件,在<profiles>标签下新增profile,加入以下内容即可,默认是被注释掉的
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
以后每次新建的项目都是1.8版本的了,是不是很简单呢?