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

后端 未结 10 1745
走了就别回头了
走了就别回头了 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:50

    copy your path wher you put the file gradle-5.0-rc-5-bin.zip example: path C:/My doc/tools

    if you have some spaces in your path change it with %20

    file:///C:/My%20doc/tools/gradle-5.0-rc-5-bin.zip

    and execute the command:

    $ gradlew wrapper --gradle-version 5.0-rc-5
    
    0 讨论(0)
  • 2020-12-04 06:51

    // Do not use android 8 as it will keep downloading grade distribution use grade 7

    ionic cordova platform add android@8.0.0

    // This will run

    ionic cordova platform add android@~7.1.1 --save

    Then run below and this time it should get success( Worked for me)

    ionic cordova build android

    0 讨论(0)
  • 2020-12-04 06:52

    I download to

    C:\data\Setup\Development\Gradle 2.11\gradle-2.11-all.zip
    

    inside Eclipse, I declare:


    Then I create new Gradle project (with wrapper) very fast, no need download. (Easy more than this solution)

    0 讨论(0)
  • 2020-12-04 06:53

    create local server to mock https download(maybe a little complex),but it work
    1. install tomcat then unzip and exec E:\apache-tomcat-8.5.4\bin\startup.bat

    2.put gradle-2.14.1-all.zip to E:\apache-tomcat-8.5.4\webapps\ROOT\distributions

    3.change url like this distributionUrl=http\://localhost:8080/distributions/gradle-2.14.1-all.zip
    now run as usual

    0 讨论(0)
  • 2020-12-04 06:54

    Just drag downloaded gradle file in your browser address bar and then copy address from address bar and change gradle/wrapper/gradle-wrapper.properties as following:

    distributionUrl=ADDRESS THAT COPY FROM YOUR BROWSER
    

    example:

    distributionUrl=file:///E:/gradle/gradle-4.1-all.zip
    

    or you can copy gradle.zip file to wrapper folder then use relative path:

    distributionUrl=gradle.zip
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题