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;





©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值