當使用一個新的eclipse環境或新創建一個工作空間后,需進行如下操作:
基本配置:
1.設置編碼格式,General--Workspace--Text file encoding(UTF-8)
2.設置換行符,General--Workspace--New text file line delimiter(Unix)
3.設置jdk路徑,Java--Installed JREs--Add(選擇本地jdk路徑)
4.設置JSP編碼格式,Web--JSP Files(選擇UTF-8)
maven配置:
1.更換IDE內嵌的maven,選擇Installations,單機右側Add按鈕,選擇本地maven路徑。
2設置maven,點擊maven,勾選右側
3.進入maven-User Settings(選擇本地maven的配置文件)
注:maven 可以配置使用阿里雲的鏡像,速度較快(maven/conf/settings.xml)
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
可選配置:
1.將 tab 轉為 4 個空格,Window--Preferences--General--Editors--Text Editors,勾選右側
2.設置代碼風格,Java--Code Style--Formatter(這里選用google的,導入eclipse-java-google-style.xml [https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml]),選擇Editor,設置Indentation size 為 4
設置保存代碼時自動格式化代碼,Java--Editor-Save Actions: