No compiler is provided in this environment. Perhaps you are running on a JR

maven编译项目时出错,提示信息如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project springside-core: 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

解决方案:

1.下载java jdk,并安装java jdk。下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

在eclipse的菜单中,进入 Window > Preferences > Java > Installed JREs > Execution Environments,选择JavaSE-1.6, 在右侧选择jdk.

然后在maven菜单中使用 “update project ...”.关键是这个点击工程的右键,升级当前的项目,否则项目上面有叉叉。

2.选择现有jdk

在eclipse的菜单中,进入 Window > Preferences > Java > Installed JREs >Standard VM,选择jdk文件夹, 应用就好了.

jdk是开发工具 

jre是运行环境 

编译用的都是jdk的resources嘛,开发时不能只有运行库,应该具备开发库,就是这个意思。

=====================================================================================

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容