在用maven编译项目时报了一个错 java -source 1.5 中不支持 diamond 运算符 百度之后发现maven默认使用java5编译项目,如果没有指定jdk版本号就会有问题。
只要在pom.xml文件中指定jdk版本号就可以了
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>