1.下載文件到D盤,
①jdk-1.6.0 URL: http://java.sun.com/javase/downloads/index.jsp#docs
②apache-ant-1.7.0 URL: http://archive.apache.org/dist/ant/binaries/
③apache-maven-2.2.1 URL: http://maven.apache.org/download.html
④apache-tomcat-6.0.20 URL: http://tomcat.apache.org/download-60.cgi
⑤eclipse-jee-galileo-SR1-win32 URL: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-jee-galileo-SR1-win32.zip
⑥m2eclipse plug URL:http://m2eclipse.sonatype.org/installing-m2eclipse.html
2.配置環境變量。jdk,ant,maven。
3.安裝m2eclipse plug
4.在E盤新建文件夾workspace,新建工程check代碼(url:http://172.29.131.23/repo/nat/0.Projects_dev/enbk/trunk)。
5.eclipse配置。
5.1 Window->Preferences->Java->Installed JREs 添加D:\apps\jdk-1.6.0;點擊Edit,在Default VM Arguments: 輸入“-server -Xms1024m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256m”。
5.2 Window->Preferences->Maven->Installations 添加D:\apps\apache-maven-2.2.1,取消Embedded選項。
5.3 Window->Preferences->Java->Compiler 確認Compiler compliance level:爲1.6。
5.4 Window->Preferences->General->Editors->Text Editors 確認Displayed tab width:爲4。
6.導入工程及每個工程的配置。
6.1 導入工程。Import->Maven Projects->Next 選擇工程(例E:\eworksparce\enbk)
6.2 配置每個工程。Properties->Resource 配置Text file encoding->Other 爲UTF-8。(注:項目不允許出現中文)
6.3 配置每個工程。Properties->Java Build Path 選中Libraries,Remove JRE System Library,Add Library JRE System Library。
6.4 配置每個工程。Properties->Java Compiler 取消Enable project specific settings 或 設置Compiler compliance level:爲1.6。
7.拷貝文件settings.xml, 放置到當前用戶的主目錄(例C:\Documents and Settings\admin\.m2)下。文件作用:根據配置信息從本地服務器下載jar包,否則會按照url地址,從網絡下載jar包。
8.Run Configurations->Maven Build 新建工程名;點擊Browse Workspace... 添加主工程;在Goals輸入 clean package install tomcat:deploy。
9.啓動本地tomcat。
10.在IE輸入http://localhost:8080查看tomcat是否成功。
11.修改代碼後執行run->E-Notebook。
12.在IE輸入http://localhost:8080/enbk/login.jsp查看是否成功。
13.設置斷點並調試。
注:個別目錄需要根據你的項目名稱而定,如有不對之處請指教,本人菜鳥,希望共同學習。