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!
相關文章
相關標籤/搜索