问题描述:
在idea2017中基于Maven(3.6的版本)创建模块后new出来的集合中出现了数据类型
List<Employee> employeeList=new ArrayList<Employee>;
原因分析:
因为maven创建的模块默认jdk为1.7所以才会有以上情况
解决方案:
可设置局部或者全局的设置jdk的版本
局部:在当前模块的pom.xml中加入build
<project.....>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
全局:在maven安装路径下的conf文件夹内中的settings.xml中的元素中加入以下代码
<profile>
<id>jdk18</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>