Gradle是一個好用的構建工具java
使用它的緣由是git
一、配置相關依賴代碼量少,不會像maven同樣xml過多github
二、打包編譯測試發佈都有,並且使用起來方便spring
三、利用自定義的任務能夠完成本身想要的功能eclipse
1、Gradle的下載與安裝maven
- 下載地址http://services.gradle.org/distributions/
- 下載你所須要對應的版本,gradle-4.6-bin.zip
- 下載完畢後,解壓zip至安裝目錄便可,例如:D:\Program Files
- 設置環境變量,須要設置以下2個環境變量,添加GRADLE_HOME指向gradle的安裝目錄的根目錄D:\Program Files\gradle-4.6,Path變量添加gradle的bin目錄D:\Program Files\gradle-4.6\bin
- 以上步驟設置完畢,打開cmd,運行gradle -v看到gradle的版本信息,配置完成
2、在線安裝地址指南
- https://github.com/eclipse/buildship/blob/master/docs/user/Installation.md,找到對應的eclipse版本拷貝連接
- 打開eclipse,依次按如下步驟操做
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
後面下一步下一步,贊成協議便可,最後在eclipse中配置你Gradle文件的所在位置工具
![](http://static.javashuo.com/static/loading.gif)
3、eclipse新建gradle項目
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
看到新建項目的預覽信息:測試
![](http://static.javashuo.com/static/loading.gif)
單擊finish,這將觸發gradle init --type java-library命令並導入項目,建立出來的項目目錄結構以下gradle
![](http://static.javashuo.com/static/loading.gif)
4、eclipse導入gradle項目
https://start.spring.io/建立gradle項目ui
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)