How to use gradle zip in local system without downloading when using gradle-wrapper

后端 未结 10 1794
走了就别回头了
走了就别回头了 2020-12-04 06:29

I\'m trying to build a gradle project with gradle-wrapper (gradlew).

When I build with ./gradlew build, it outputs text

10条回答
  •  忘掉有多难
    2020-12-04 06:56

    From gradle-wrapper documentation, I found in section 61.1. Configuration

    If you don't want any download to happen when your project is build via gradlew, simply add the Gradle distribution zip to your version control at the location specified by your wrapper configuration. A relative URL is supported - you can specify a distribution file relative to the location of gradle-wrapper.properties file.

    So, I changed distributionUrl property in gradle-wrapper.properties to

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=gradle-1.11-bin.zip
    

    Then, I made a copy of gradle-1.11-bin.zip in gradle/wrapper/.

    Then, ./gradlew build downloaded local copy of zip and built the project.

提交回复
热议问题