1. 程式人生 > >maven install 報錯,解決Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile

maven install 報錯,解決Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile

在碰到maven install 發現報錯

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project autotest_fchtgl: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [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

分析: 對這個問題其實報錯中已經說的很清楚了,看第一條最後的 Perhaps you are running on a JRE rather than a JDK?

就是說你可能編譯在一個JRE而不是JDK上,maven 編譯是要JDK的,可能你的編譯器配置了一個jre路徑。

解決: 在eclipse中,選擇window→preference→java→Installed JREs 點add新增你的jdk路徑,選jdk而不是jre,之前的報錯原因就出在這裡。 在這裡插入圖片描述 然後右鍵你的maven工程,在maven中點選update project,然後maven clean,install 一下就好了。