项目被搭建成了project项目,感受很别扭,因此,手动进行了一下转换,具体步骤以下:
1.进入项目目录,可看到.project文件,打开,找到<natures>...</natures>代码段。
2.将以下代码加入到其中<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
3.在eclipse的项目上点右键,刷新项目
4.在项目上点右键,进入属性(properties)
5.在左侧列表项目中点击选择“Project Facets”,在右侧选择“Dynamic Web Module”和"Java",点击OK保存便可。
因为咱们系统原来的web目录使用的名字是WebRoot,因此,系统又自动生成了一个WebContent目录,这个不要紧,直接删除,而后进入到项目目录下。在.settings目录下找到org.eclipse.wst.common.component文件。
其中有这么一句“<wb-resource deploy-path="/" source-path="/WebContent"/>”,将WebContent改成WebRoot便可。
如今一切都已经搞定,能够试着运行一下了,点Run As 却悲剧了,报错“The server does not support version 3.0 of the J2EE Web module specification”,查了一下资料,原来在.settings目录下有一个org.eclipse.wst.common.project.facet.core.xml文件,其中有这么一句“<installed facet="jst.web" version="3.0"/>”将其改成“<installed facet="jst.web" version="2.5"/>”,保存,刷新项目,再运行,ok!