gpt4 book ai didi

java - Maven编译java报错diamond Operator is notsupported

转载 作者:太空宇宙 更新时间:2023-11-04 11:40:15 25 4
gpt4 key购买 nike

我正在使用 Maven 和 Eclipse ,编译项目时出现以下错误

 [INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/copay/CopayMobilePassBook/src/main/java/com/cherry/copay/mpassbook/process/impl/AccountsProcessImpl.java:[17,55] diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)
[ERROR] /D:/copay/CopayMobilePassBook/src/main/java/com/cherry/copay/mpassbook/process/support/ReversalProcessSupport.java:[89,88] diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)
[INFO] 2 errors

但是安装的JDK版本是8项目 -> 右键单击​​ -> 属性 -> 项目事实 -> java 版本是 1.8

我的maven配置有什么问题

最佳答案

可能是maven编译器插件配置问题

您可以检查堆栈溢出答案:-

maven-compilation-error-use-source-7-or-higher-to-enable-diamond-operator

您可以使用合适版本的JDK版本

<properties>
<maven-compiler-plugin>3.0</maven-compiler-plugin>
<jdk-version>1.8</jdk-version>

</properties>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin}</version>
<configuration>
<compilerVersion>${jdk-version}</compilerVersion>
<source>${jdk-version}</source>
<target>${jdk-version}</target>
</configuration>
</plugin>

关于java - Maven编译java报错diamond Operator is notsupported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42871882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com