maven项目报错:找不到编译器

来源:互联网 发布:linux 获取文件行数 编辑:程序博客网 时间:2024/05/19 12:37

在运行maven项目时,报错

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project taotao-manager-pojo: 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/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command


大概的意思是说,在当前环境没提供编译器。于是打开 window->preferences->java->install JREs,发现jre是正常配置的。



但是错误报的是找不到编译器,也就是JDK,后面还提醒了一句,也许你是在jre里面运行,而不是jdk。对照上图可以看到,确实是选择的只是jre。我们在安装java的时候,会在java目录下生成jre文件夹,同时在jdk文件夹下也生产jre文件夹。





所以,解决办法就是选择jdk目录下的jre,而不是java目录下的jre。点击edit->directory->选择jdk目录下的jre,就像这样



点击finish,然后在项目上右键->maven->update project,再运行,成功。问题解决


0 0
原创粉丝点击