eclipse中另起了一个workspace,然后跑maven项目,报错:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK。咨询了下度娘,找到了下面这篇文章解决了这个问题。
引用博客地址 : http://blog.csdn.net/vah101/article/details/24660795
1. 首先安装maven插件,进入eclipse的help->marketplace,在find框中输入“maven”,选择“maven integration for eclipse(juno and newer)”项的install按钮
2. 进入window->preferences窗口,选择java->Installed JREs,默认情况下只有eclipse一项,这里要通过add按钮增加jdk对对应的路径加进来,否则在编译的时候会报错:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
接着,进入Installed JREs的子项Execute Environment:在左侧选择JavaSE-1.6,右侧选择jdk
3. 在项目文件上单击右键,选择Maven->update project。
如果这个项目不是maven项目,则单击项目图标,现在configure->Convert to Maven project
4. 右键,选择Run As->Maven install,之后会开始下载编译过程中所需的文件
5. 之后,选择Maven Build,第一次运行会出现Run Configurations对话框,主要是在Goals框中输入要编译出的目标文件,Goals的选项包括:
validate
initialize
generate-sources
process-sources
generate-resources
process-resources
compile compile
process-classes
generate-test-sources
process-test-sources
generate-test-resources
process-test-resources
test-compile
process-test-classes
test
prepare-package
package
pre-integration-test
integration-test
post-integration-test
verify
install
deploy
如果goals不输入内容,编译的时候会提示
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format.....
进一步的细节可以参考 http://gavin-chen.iteye.com/blog/336607