Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gradle

gradlew

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?

like image 923
ptkvsk Avatar asked Apr 25 '19 12:04

ptkvsk


People also ask

Can we change the Gradle wrapper distribution type?

Upgrading the Gradle Wrapper One way to upgrade the Gradle version is manually change the distributionUrl property in the Wrapper's gradle-wrapper. properties file. The better and recommended option is to run the wrapper task and provide the target Gradle version as described in Adding the Gradle Wrapper.

How do you change Gradle wrapper properties?

Open gradle-wrapper. properties(go to Gradle > wrapper > gradle-wrapper. properties and manually change the distributionUrl property in the file.


1 Answers

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.

like image 106
ptkvsk Avatar answered Oct 19 '22 04:10

ptkvsk