我在eclipse中使用maven創建了一個webapp項目。當我在命令提示符下運行命令mvn包時,它顯示出錯信息。Maven包編譯錯誤
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.310s
[INFO] Finished at: Tue Mar 05 14:32:23 IST 2013
[INFO] Final Memory: 16M/218M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project Compilation fa
ilure
[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
我試圖改變jdk和jre。但不工作。仍然顯示相同的錯誤
在控制檯中,你的'javac'輸出是什麼? – Raptor 2013-03-05 09:40:43
你運行過'mvn -e package'嗎? – orique 2013-03-05 09:41:21
您應該仔細閱讀錯誤消息:** [錯誤] ***在此環境中不提供編譯器。也許你正在運行JRE而不是JDK?*****。我會建議檢查JAVA_HOME,如果它指向一個JDK和** NOT **到JRE。 – khmarbaise 2013-03-05 19:34:06