How can I use already dowloaded gradle distribution?
已回答
When gradle build starts for the first time IDEA downloads gradle distribution set in gradle-wrapper.properties and it is used for every build. But when I need to call ./gradlew command from console, e.g. to --stop daemon it downloads distribution again to another place. This happens once for IDE and once for console.
But how one, downloaded at the first build, distrbution can be used both when calling wrapper from console and building from IDE?
请先登录再写评论。
When you use Gradle wrapper, and use it for the 1st time in IDE - it downloads (only once) certain gradle version for itself to run the Gradle. It is not possible to configure the Gradle wrapper version yet. See https://youtrack.jetbrains.com/issue/IDEA-177325. See also https://youtrack.jetbrains.com/issue/IDEA-120260#focus=streamItem-27-669189-0-0.
I find a way to replace the downloading temp file to accelerating the process. You may already have downloaded gradle file.
1. Find out your Gradle home dir. You can find it in settings. It is called GRADLE_HOME in the following.
2. Open the project and wait Gradle downloading start ( so idea create the folder and temp file). Find out which version it is downloading, you may find it in the progress bar, and it may also display the download link.
3. Close idea and goto <GRADLE_HOME>/wrapper/dists/<the version it was downloading>, for me it's gradle-6.1.1-bin. Enter the folder and a randomly named sub-folder.
4. There is a lock file and temp file.
5. Put a copy of file it was downloading (may have been already downloaded). Del the .part file and create a new empty one with ".ok" extension. Ignore the gradle-6.1.1 folder, it will be created by idea after restart.
6. Restart idea and it will start indexing the project.