一、首先根據項目中 gradle\wrapper\gradle-wrapper.properties 文件的 distributionUrl 屬性的值html
#Tue Feb 06 12:27:20 CET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
二、根據 distributionUrl 對應的 gradle 的版本好,去下載相應的版本,能夠經過 迅雷 或者其餘國內網站下載,下載後先保存在本地,等待後續使用linux
三、運行 gradle build 命令進行構建spring
# Windows 下使用
gradlew.bat build
# Linux mac 下使用
gradlew build
運行之後,提示下載時,終止掉app
終止掉後,打開此文件夾 $GRADLE_USER_HOME/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn maven
橙色字體可能會和我不同,無所謂spring-boot
提示:這個文件夾大多數都在用戶主目錄下 .gradle//wrapper/dists/... 下工具
四、在進入上一步說的文件夾之後先刪除全部文件,而後把第二步下載好的 zip 文件複製到此文件夾下 $GRADLE_USER_HOME/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn 。字體
五、再次執行 gradle build (注意 Windows 和 linux的命令不一樣),會變成以下,不須要再下載這個文件了,編譯會很快經過gradle
C:\Users\duwenlei\IdeaProjects\spring_boot_demo λ gradlew.bat build Unzipping C:\Users\duwenlei\.gradle\wrapper\dists\gradle-4.8.1-bin\e8p42vx1m7a3mz9ydmjagn6wn\gradle-4.8.1-bin.zip to C:\Users\duwenlei\.gradle\wrapper\dists\gradle-4.8.1-bin\e8p42vx1m7a3mz9ydmjagn6wn Welcome to Gradle 4.8.1! Here are the highlights of this release: - Dependency locking - Maven Publish and Ivy Publish plugins improved and marked stable - Incremental annotation processing enhancements - APIs to configure tasks at creation time For more details see https://docs.gradle.org/4.8.1/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) ... Download http://maven.aliyun.com/nexus/content/repositories/central/org/springframework/boot/spring-boot-starter-test/2.0.6.RELEASE/spring-boot-starter-test-2.0.6.RELEASE.jar > Task :test 2018-10-25 23:34:55.551 INFO 588 --- [ Thread-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@413698fe: startup date [Thu Oct 25 23:34:52 CST 2018]; root of context hierarchy BUILD SUCCESSFUL in 1m 5s 5 actionable tasks: 5 executed
六、完結,能夠在經過 IDEA 或者其餘編碼工具打開工程,跳過了慢悠悠的下載過程。網站