无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:在项目上编译(default-compile)

时间:2017-02-06 19:39:16

标签: java maven intellij-idea compiler-errors compilation

Maven告诉我以下内容,即使我已将所有内容设置为Java 8。

File -> Project Structure -> Modules

[编辑配置 - > Maven - >构建 - >运行] [2]

[默认项目结构] [3]

所有都设置为语言级别8

[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.730 s
[INFO] Finished at: 2017-02-06T20:29:55+01:00
[INFO] Final Memory: 7M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project kingdoms: Compilation failure
[ERROR] /C:/Users/Marius/Desktop/IntelliJ projects/Kingdoms/src/main/java/me/expdev/kingdoms/files/JsonConfig.java:[24,54] diamond operator is not supported in -source 1.6
[ERROR] (use -source 7 or higher to enable diamond operator)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

非常感谢任何帮助。我试过谷歌搜索,但没有发现任何人有这个错误,因此诉诸Stack Overflow。

注意:我正在使用已获许可的IntelliJ Ultimate Edition(如果相关)。

1 个答案:

答案 0 :(得分:0)

检查pom.xml并确保将编译器源设置为1.7或更高。请参阅:https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html