在碰到maven install 發現報錯java
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/MojoFailureExceptionapache
分析:app
對這個問題其實報錯中已經說的很清楚了,看第一條最後的 Perhaps you are running on a JRE rather than a JDK?eclipse
就是說你可能編譯在一個JRE而不是JDK上,maven 編譯是要JDK的,可能你的編譯器配置了一個jre路徑。maven
解決:ide
在eclipse中,選擇window→preference→java→Installed JREs 點add添加你的jdk路徑,選jdk而不是jre,以前的報錯緣由就出在這裏。this
而後右鍵你的maven工程,在maven中點擊update project,而後maven clean,install 一下就行了。spa