【问题标题】:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project [duplicate]无法在项目上执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) [重复]
【发布时间】:2017-06-23 21:00:00
【问题描述】:

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,已获得许可,如果相关的话。

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-04
      • 2018-03-04
      • 2016-08-06
      • 1970-01-01
      • 2017-02-18
      • 2020-03-24
      • 2019-04-09
      • 2017-07-20
      相关资源
      最近更新 更多