Maven編譯打包項目 mvn clean install 遇到的錯誤

在進行Maven 編譯項目時執行命令:mvn  clean install遇到的問題:

[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: ??Ч??Ŀ??汾?? 1.8
?÷?: javac <options> <source files>
-help ?????г????ܵ?ѡ??

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.068 s
[INFO] Finished at: 2015-07-10T09:49:08+08:00
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project robot: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] javac: ??Ч??Ŀ??汾?? 1.8
[ERROR] ?÷?: javac <options> <source files>
[ERROR] -help ?????г????ܵ?ѡ??
[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



解決方案:

/etc/profile配置java的環境變量: 你的mvn 項目是用哪個版本的jdk. 就要配置那個版本的jdk.

我的配置如下:(根據你自己的JDK的位置:)

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home  (你自己的jdk的位置)
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
然後強制保存文件命令:

:w !sudo tee %

此時在進入項目執行:

$ git pull origin master

繼續mvn clean install;





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章