項目場景:
創(chuàng)建了一個maven工程,編譯時報錯
問題描述
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project mybatisplus: Fatal error compiling: 無效的標記: --release -> [Help 1]
原因分析:
項目中maven-plugin版本不匹配。我的IDEA版本2023.2.3,JDK版本為1.8.我是把自己的maven版本降低到3.5.1,編譯通過。
解決方案:
在pom.xml中配置編譯插件以使用正確的Java版本。添加以下配置到pom.xml中:
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
后續(xù)問題
出現(xiàn)警告:[WARNING] Parameter ‘parameters’ is unknown for plugin 'maven-compiler-plugin:3.5.1:compile (default-compile)
解決方案:
將maven-compiler-plugin版本改成3.8.1即可文章來源:http://www.zghlxwxcb.cn/news/detail-754618.html
注意:
我的項目中使用了springboot,版本為2.7.14。Spring官方發(fā)布從Spring6以及SprinBoot3.0開始最低支持JDK17,我使用的JDK8,所以選擇一個3.0以下的版本即可。
如果修改springboot版本后報錯Project ‘org.springframework.boot:spring-boot-starter-parent’ not found,那么有可能是緩存的原因,可以清理一下idea的緩存。文章來源地址http://www.zghlxwxcb.cn/news/detail-754618.html
到了這里,關于idea編譯maven項目報錯:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!