Eclipse集成Maven的几个问题

来源:互联网 发布:sql server2012和2014 编辑:程序博客网 时间:2024/06/08 10:19

本文的以下内容在网上参考了一些资料,整理了下:

1.创建Maven项目后可能会出现 Eclipse is running in a JRE, but a JDK is required Some Maven plugins may not work when importing projects or updating source folders.

解决方法:在eclipse.init文件中-vmargs之前添加

-vm
C:/Program Files/Java/jdk1.6.0_23/bin/javaw.exe (该路径自己根据jdk安装路径配置)

注意 Eclipse默认是运行在JRE中bin/javaw.exe

以上参考Maven实战

2.在eclipse中pop.xml run as Maven bulid 在 run configurations 配置 Goals 值为 clean compile发生错误:

Unable to locate the Javac Compiler in:C:/Program Files/Java/jre6/../lib/tools.jar

解决方法:跟前面比较相似 更改windows -preferences-java-installed jres

新建 standard vm ,jre home 指定 jdk下面的jre 如C:/Program Files/Java/jdk1.6.0_23/jre 并使用。

3.在eclipse中pop.xml run as Maven bulid 在 run configurations 配置 Goals 值为 clean test发生错误:

Unable to locate the Javac Compiler in:C:/Program Files/Java/jre6/../lib/tools.jar

需要在第2步中edit jre 在 jre system libraries 添加 external jars :C:/Program Files/Java/jdk1.6.0_23/lib/tools.jar