1. 程式人生 > >idea專案匯入eclipse中步驟

idea專案匯入eclipse中步驟

1、開啟eclipse,右鍵import
這裡寫圖片描述
找到需要匯入的專案
2、重新配置tomcat,已經配置好了建議移除後重新新增,
window-preference這裡寫圖片描述
3、專案上右鍵-debug AS-發現沒有 debug on server,這是沒有轉成web專案
專案右鍵-properties
這裡寫圖片描述
配置好後會出現debug on server,啟動會報錯(沒報錯也訪問不了專案)

4、發現pom.xml檔案報錯現
web.xml is missing and is set to true
網上說webapp下沒有web.xml導致的,但是這是原來在idea上可以使用的,所以不存在沒有web.xml,實際上也不存在沒有web.xml,所以以下方法是針對有web.xml 情況下的
專案-Properties-Deployment Assembly-add-Folder-src-main-webapp
儲存
最後project-clean下
這裡寫圖片描述


如上圖已經新增webapp
5、啟動tomcat,發現報錯
Error configuring application listener of class org.springframework.web.context.ContextLoaderListene
由於我這是maven專案
右鍵專案->Properties->Deployment Assembly,看看有沒有Maven Dependencies,發現沒有
沒有的話,點Add,選Java Build Path Entries ,拉到最下面,就可以看到Maven Dependencies,這樣新增進去就可以了。
這裡寫圖片描述

6、接著重啟tomcat,哈哈,發現又報錯了,但這次報的錯誤不一樣了
class path resource [spring-mybatis.xml] cannot be opened because it does not exist
說我的spring-mybatis.xml不存在,胡說,絕對胡說!!!
解決辦法,新增resource,如圖,頁面是不是很熟悉,
add-folder-選resource資料夾,deploy path裡的內容,我是複製進去的
這裡寫圖片描述

7、再啟動,沒報錯,訪問,可以訪問,收工!!!