目前使用springboot框架的IT項目越來越多,在此總結一下用eclipse搭建springboot開發環境的步驟:
1、下載maven
官網:http://maven.apache.org/download.cgi
2、maven配置過程
(1)解壓下載的maven文件,然後打開eclipse,window——preferences——maven——installations
(2)點擊上圖中的add,添加剛剛解壓的maven文件目錄
(3)點擊finish即可
(4)打開maven解壓文件,找到apache-maven-3.6.0/conf 下的 settings.xml文件,並使用文本編輯器打開,修改該文件
添加以下內容:
<!--配置maven本地jar倉庫,即jar包保存在本機的路徑-->
<localRepository>F:\eclipse\maven\localRespository</localRepository>
<!--使用阿里雲鏡像-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
如圖所示:
(5)更新eclipse的maven配置路徑,window——preferences——maven——User Settings,選擇剛剛修改的settings.xml文件,點擊apply and close即可
(6)重啓eclipse即可
3、接下來下載sts插件,首先打開eclipse安裝目錄中的.eclipseproduct文件,查看自己的eclipse版本號,然後下載對應版本的sts插件。
(1)sts官網下載地址:https://spring.io/tools3/sts/legacy
在這裏注意,官網提供的下載會得到兩個不同的文件
①spring-tool-suite-3.9.3.RELEASE-e4.7.3-win32-x86_64.zip
②springsource-tool-suite-3.9.3.RELEASE-e4.7.3-updatesite.zip
如果採用①,後期eclipse配置時會有問題,如下:
我們需要的是②,在這裏有個技巧,我們打開https://spring.io/tools3/sts/legacy找到自己eclipse所對應的sts插件版本,然後在文件上右擊,複製鏈接地址,
然後我們在瀏覽器裏新打開一個窗口,將鏈接地址粘貼,例如我的是 https://download.springsource.com/release/STS/3.9.3.RELEASE/dist/e4.7/spring-tool-suite-3.9.3.RELEASE-e4.7.3-win32-x86_64.zip
然後我們將鏈接中的STS替換爲TOOLS/update,去掉dist/,最後,將最後的文件名spring-tool-suite-3.9.3.RELEASE-e4.7.3-win32-x86_64.zip改爲springsource-tool-suite-3.9.3.RELEASE-e4.7.3-updatesite.zip即可得到對應的②文件。
(2)打開Eclipse,Help— Install new Sofware 點擊Add按鈕 ,再點擊Archive 選擇剛剛下載的zip文件(例如我的是:springsource-tool-suite-3.9.3.RELEASE-e4.7.3-updatesite.zip) ,點擊ok即可。
(3)然後我們勾選出需要的組件,一般web項目,只需要四個文件即可。最後那個contact all update sites...不勾選,是因爲我們是 本地安裝的,如果勾選,會導致速度變慢。
點擊next,等待組件安裝。(這裏預計花費時間較長)
(4)組件安裝成功之後,點擊next,然後接受協議即可完成安裝。
(5)重啓eclipse即可安裝成功,window——preferences——spring
更多學習課程請關注小鹿老師的視頻課程:http://edu.51cto.com/lecturer/13072457.html