eclipse+maven环境搭建问题总结

来源:互联网 发布:有哪些搜索算法 编辑:程序博客网 时间:2024/05/22 03:33

安装时所参考的教程为:

使用Eclipse构建Maven项目 (step-by-step)


首先非常感谢这位博主的无私奉献,但是,楼主在安装过程中还是遇到了一系列问题,因此写下此文记录,以方便后人参考。

问题1:安装完之后,创建webapp项目,出现警告,内容为:

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.


解决办法:

首先检查是否成功安装了JRE,若有成功安装,一般是因为版本不符导致,这里默认绑定的版本是1.5,楼主安装的1.8,所以自然不能成功。

一般设置解除绑定,再重新绑定已经安装的版本即可。操作步骤如下:

选择工程,单击右键,依次选择Build Path- Configuration Build Path,看到以下页面:


选中JRE SYSTEM LIbrary[J2SE-1.5],移除之,再选择添加库[add library]-JRE SYSTEM LIbrary-使用默认安装的JRE。搞定~

问题2:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path


Tomcat的问题,解决办法网上很多,选择工程文件夹单击右键,依次选择Build Path- Configuration Build Path-library-add library-server runtime.如果有tomcat给你选,就选一个版本,网上都是选7.0.

我遇到的问题是打开是一片空白,开始找了很多答案都不知道为什么,后来猜测自己是否没有装Tomcat,就装了一个7.0.装完之后,通过preference添加,操作方法:Windows-preferences-server-runtime environment-add。把你安装好的tomcat路径添加上去,然后回到上一段描述的方法,就会发现可以选择tomcat7.0了。

设置完之后clean一下就好。


问题3:

描述:

Failure to transfer org.codehaus.plexus:plexus-utils:jar:3.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-utils:jar:3.0 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000pom.xml/testweb_mvnline 1Maven Configuration Problem

解决办法:

首先看maven的user settings和你自己选择的目录是否一致。

操作步骤:依次选择 Windows-preferences-maven-user settings

楼主安装时参考了上面所说的那篇文章,把repository目录建立在了D盘,同时把Apache-maven的settings文件也放在了D盘,但是在设置user settings路径的时候,用D盘的settings文件读出来的local repository依然是C盘,这两个地方不一致,所以出了问题。如果你也和我一样的问题,建议把settings用默认的设置,不要改它,然后打开你的CMD执行下面的操作:

cd %userprofile%\.m2\repositoryfor /r %i in (*.lastUpdated) do del %i
参考这个:https://stackoverflow.com/questions/5074063/maven-error-failure-to-transfer

我遇到的问题基本上就是这些。

没有错误没有警告的eclipse界面看着真舒服大笑