Search code examples
gradlegradlew

Gradle Wrapper - how to use different distributionUrls for Local vs CI builds?


I want to use distributionUrl pointing to "ALL" for local builds, but "BIN" for CI builds.

Let's say I run Gradle Wrapper locally like this:

./gradlew test

And my gradle-wrapper.properties file (which is checked-in to VCS) points to "ALL" distribution:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

Is there a parameter I can pass to ./gradlew test to change distribution-type to BIN?


Solution

  • Run

    sed -i 's/all.zip/bin.zip/g' gradle/wrapper/gradle-wrapper.properties
    

    before running ./gradlew on CI.

    Imperfect, but it works for me.