【发布时间】:2015-05-29 06:28:47
【问题描述】:
我在 IntelliJ、JDK1.8、maven 3.2.5 中使用 maven。出现编译错误:使用 -source 7 或更高版本启用钻石歌剧。详情如下:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] TrainingConstructor.java:[31,55] diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
[ERROR] DTM.java:[79,21] try-with-resources is not supported in -source 1.5 (use -source 7 or higher to enable try-with-resources)
[ERROR] ticons.java:[53,44] diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator)
有什么建议吗?是否有任何其他配置来设置此 -source 级别?似乎它不使用java 1.8。
【问题讨论】:
-
你的 maven-compiler-plugin 配置怎么样?
-
什么是 JAVA_HOME 环境变量值?
-
从 maven 插件下拉列表中,我使用 org.apache.maven.plugins:maven-compiler-plugin:2.3 找到它
-
JAVA_HOME 环境变量设置为 java jdk 位置:C:\Program Files\Java\jdk1.8.0_40
标签: java maven intellij-idea maven-3