Eclipse中project项目转web项目

项目被搭建成了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!

猜你喜欢

转载自chilongxph.iteye.com/blog/1995336