关闭

Maven编译打包项目 mvn clean install 遇到的错误

标签: Maven编译打包
2792人阅读 评论(0) 收藏 举报
分类:

在进行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;





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:42077次
    • 积分:723
    • 等级:
    • 排名:千里之外
    • 原创:28篇
    • 转载:8篇
    • 译文:0篇
    • 评论:4条
    博客专栏
    文章分类